Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ino_common.h"
Toshihiro Shimizu 890ddd
/* tnzbase --> Source Files --> tfx --> binaryFx.cppを参照 */
Shinya Kitaoka d1f6c4
class ino_blend_cross_dissolve final : public TBlendForeBackRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(ino_blend_cross_dissolve)
Shinya Kitaoka 120a6e
  TRasterFxPort m_up;
Shinya Kitaoka 120a6e
  TRasterFxPort m_down;
Shinya Kitaoka 120a6e
  TDoubleParamP m_opacity;
Shinya Kitaoka 120a6e
  TBoolParamP m_clipping_mask;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ino_blend_cross_dissolve()
Shinya Kitaoka 120a6e
      : m_opacity(1.0 * ino::param_range()), m_clipping_mask(false) {
Shinya Kitaoka 120a6e
    addInputPort("Fore", this->m_up);
Shinya Kitaoka 120a6e
    addInputPort("Back", this->m_down);
Shinya Kitaoka 120a6e
    bindParam(this, "opacity", this->m_opacity);
Shinya Kitaoka 120a6e
    bindParam(this, "clipping_mask", this->m_clipping_mask);
Shinya Kitaoka 120a6e
    this->m_opacity->setValueRange(0, 1.0 * ino::param_range());
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  ~ino_blend_cross_dissolve() {}
Shinya Kitaoka 38fd86
  bool canHandle(const TRenderSettings &rs, double frame) override {
Shinya Kitaoka 38fd86
    return true;
Shinya Kitaoka 38fd86
  }
Shinya Kitaoka 38fd86
  bool doGetBBox(double frame, TRectD &bBox,
Shinya Kitaoka 38fd86
                 const TRenderSettings &rs) override {
Shinya Kitaoka 120a6e
    TRectD up_bx;
Shinya Kitaoka 120a6e
    const bool up_sw =
Shinya Kitaoka 120a6e
        (m_up.isConnected() ? m_up->doGetBBox(frame, up_bx, rs) : false);
Shinya Kitaoka 120a6e
    TRectD dn_bx;
Shinya Kitaoka 120a6e
    const bool dn_sw =
Shinya Kitaoka 120a6e
        (m_down.isConnected() ? m_down->doGetBBox(frame, dn_bx, rs) : false);
Shinya Kitaoka 120a6e
    if (up_sw && dn_sw) {
Shinya Kitaoka 120a6e
      bBox = up_bx + dn_bx;
Shinya Kitaoka 120a6e
      return !bBox.isEmpty();
Shinya Kitaoka 120a6e
    } else if (up_sw) {
Shinya Kitaoka 120a6e
      bBox = up_bx;
Shinya Kitaoka 120a6e
      return true;
Shinya Kitaoka 120a6e
    } else if (dn_sw) {
Shinya Kitaoka 120a6e
      bBox = dn_bx;
Shinya Kitaoka 120a6e
      return true;
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      bBox = TRectD();
Shinya Kitaoka 120a6e
      return false;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  // TRect getInvalidRect(const TRect &max) {return max;}
Shinya Kitaoka 120a6e
  // void doSetParam(const std::string &name, const TParamP ¶m) {}
Shinya Kitaoka 120a6e
  int getMemoryRequirement(const TRectD &rect, double frame,
Shinya Kitaoka 473e70
                           const TRenderSettings &rs) override {
Shinya Kitaoka 120a6e
    return TRasterFx::memorySize(rect, rs.m_bpp);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 38fd86
  void doDryCompute(TRectD &rect, double frame,
Shinya Kitaoka 38fd86
                    const TRenderSettings &rs) override {
Shinya Kitaoka 120a6e
    this->dryComputeUpAndDown(rect, frame, rs, false);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 473e70
  void doCompute(TTile &tile, double frame, const TRenderSettings &rs) override;
Shinya Kitaoka 120a6e
  void computeUpAndDown(TTile &tile, double frame, const TRenderSettings &rs,
Shinya Kitaoka 120a6e
                        TRasterP &dn_ras, TRasterP &up_ras,
Shinya Kitaoka 120a6e
                        bool upComputesWholeTile = false);
Shinya Kitaoka 120a6e
  void dryComputeUpAndDown(TRectD &rect, double frame,
Shinya Kitaoka 120a6e
                           const TRenderSettings &rs,
Shinya Kitaoka 120a6e
                           bool upComputesWholeTile = false
Shinya Kitaoka 120a6e
                           /*
Shinya Kitaoka 120a6e
           upComputesWholeTile は Screen, Min, Blendでtrueにして使用している。
Shinya Kitaoka 120a6e
           */
Shinya Kitaoka 120a6e
                           );
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
FX_PLUGIN_IDENTIFIER(ino_blend_cross_dissolve, "inoCrossDissolveFx");
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Shinya Kitaoka 120a6e
namespace {
Toshihiro Shimizu 890ddd
/* より大きな四角エリアにPixel整数値で密着する */
Shinya Kitaoka 120a6e
void makeRectCoherent(TRectD &rect, const TPointD &pos) {
Shinya Kitaoka 120a6e
  rect -= pos;
Shinya Kitaoka 120a6e
  rect.x0 = tfloor(rect.x0); /* ((x)<(int)(x)? (int)(x)-1: (int)(x))*/
Shinya Kitaoka 120a6e
  rect.y0 = tfloor(rect.y0);
Shinya Kitaoka 120a6e
  rect.x1 = tceil(rect.x1); /* ((int)(x)<(x)? (int)(x)+1: (int)(x))*/
Shinya Kitaoka 120a6e
  rect.y1 = tceil(rect.y1);
Shinya Kitaoka 120a6e
  rect += pos;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void ino_blend_cross_dissolve::computeUpAndDown(TTile &tile, double frame,
Shinya Kitaoka 120a6e
                                                const TRenderSettings &rs,
Shinya Kitaoka 120a6e
                                                TRasterP &dn_ras,
Shinya Kitaoka 120a6e
                                                TRasterP &up_ras,
Shinya Kitaoka 120a6e
                                                bool upComputesWholeTile) {
Shinya Kitaoka 120a6e
  /* ------ サポートしていないPixelタイプはエラーを投げる --- */
Shinya Kitaoka 120a6e
  if (!((TRaster32P)tile.getRaster()) && !((TRaster64P)tile.getRaster())) {
Shinya Kitaoka 120a6e
    throw TRopException("unsupported input pixel type");
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /*
Toshihiro Shimizu 890ddd
m_down,m_upは繋がっている方があればそれを表示する
Toshihiro Shimizu 890ddd
両方とも接続していれば合成処理する
Toshihiro Shimizu 890ddd
表示スイッチを切ってあるならm_upを表示する
Toshihiro Shimizu 890ddd
fxをreplaceすると、
Shinya Kitaoka 120a6e
  m_source   --> m_up  (=port0)
Shinya Kitaoka 120a6e
  m_refernce --> m_down(=port1)
Toshihiro Shimizu 890ddd
となる
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
  const bool up_is = (this->m_up.isConnected() &&
Shinya Kitaoka 120a6e
                      this->m_up.getFx()->getTimeRegion().contains(frame));
Shinya Kitaoka 120a6e
  const bool down_is = (this->m_down.isConnected() &&
Shinya Kitaoka 120a6e
                        this->m_down.getFx()->getTimeRegion().contains(frame));
Shinya Kitaoka 120a6e
  /* ------ 両方とも切断の時処理しない ---------------------- */
Shinya Kitaoka 120a6e
  if (!up_is && !down_is) {
Shinya Kitaoka 120a6e
    tile.getRaster()->clear();
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ up接続かつdown切断の時 -------------------------- */
Shinya Kitaoka 120a6e
  if (up_is && !down_is) {
Shinya Kitaoka 120a6e
    this->m_up->compute(tile, frame, rs);
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ down接続時 downのみ描画して... ------------------ */
Shinya Kitaoka 120a6e
  if (down_is) {
Shinya Kitaoka 120a6e
    this->m_down->compute(tile, frame, rs);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ up切断時 ---------------------------------------- */
Shinya Kitaoka 120a6e
  if (!up_is) {
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* upと重なる部分を描画する */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ tileの範囲 -------------------------------------- */
Shinya Kitaoka 120a6e
  const TDimension tsz(tile.getRaster()->getSize()); /* 整数 */
Shinya Kitaoka 120a6e
  const TRectD tileRect(tile.m_pos, TDimensionD(tsz.lx, tsz.ly));
Shinya Kitaoka 120a6e
  TRectD upBBox;
Shinya Kitaoka 120a6e
  if (upComputesWholeTile) {
Shinya Kitaoka 120a6e
    upBBox = tileRect;
Shinya Kitaoka 120a6e
  }      /* tile全体を得る */
Shinya Kitaoka 120a6e
  else { /* 厳密なエリア... */
Shinya Kitaoka 120a6e
    this->m_up->getBBox(frame, upBBox, rs);
Shinya Kitaoka 120a6e
    upBBox *= tileRect; /* upとtileの交差エリア */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    /* より大きな四角エリアにPixel整数値で密着する */
Shinya Kitaoka 120a6e
    makeRectCoherent(upBBox, tile.m_pos);  // double-->int grid
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDimensionI upSize(                        /* TRectDをTDimensionIに変換 */
Shinya Kitaoka 120a6e
                     tround(upBBox.getLx())  // getLx() = "x1>=x0?x1-x0:0"
Shinya Kitaoka 120a6e
                     ,
Shinya Kitaoka 120a6e
                     tround(upBBox.getLy())  // getLy() = "y1>=y0?y1-y0:0"
Shinya Kitaoka 120a6e
                     );
Shinya Kitaoka 120a6e
  if ((upSize.lx <= 0) || (upSize.ly <= 0)) {
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ upのメモリ確保と描画 ---------------------------- */
Shinya Kitaoka 120a6e
  TTile upTile;
Shinya Kitaoka 120a6e
  this->m_up->allocateAndCompute(upTile, upBBox.getP00(), upSize,
Shinya Kitaoka 120a6e
                                 tile.getRaster() /* 32/64bitsの判定に使う */
Shinya Kitaoka 120a6e
                                 ,
Shinya Kitaoka 120a6e
                                 frame, rs);
Shinya Kitaoka 120a6e
  /* ------ upとdownのTRasterを得る ------------------------- */
Shinya Kitaoka 120a6e
  TRectI dnRect(upTile.getRaster()->getSize());  // TDimensionI(-)
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  dnRect += convert(upTile.m_pos - tile.m_pos); /* uptile->tile原点 */
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
  ここで問題はdoubleの位置を、四捨五入して整数値にしていること
Shinya Kitaoka 120a6e
  移動してから四捨五入ではないの???
Shinya Kitaoka 120a6e
  dnRectの元位置が整数位置なので、問題ないか...
Shinya Kitaoka 120a6e
  */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  dn_ras = upComputesWholeTile ? tile.getRaster()
Shinya Kitaoka 120a6e
                               : tile.getRaster()->extract(dnRect);
Shinya Kitaoka 120a6e
  up_ras = upTile.getRaster();
Shinya Kitaoka 120a6e
  assert(dn_ras->getSize() == up_ras->getSize());
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void ino_blend_cross_dissolve::dryComputeUpAndDown(TRectD &rect, double frame,
Shinya Kitaoka 120a6e
                                                   const TRenderSettings &rs,
Shinya Kitaoka 120a6e
                                                   bool upComputesWholeTile) {
Shinya Kitaoka 120a6e
  const bool up_is = (this->m_up.isConnected() &&
Shinya Kitaoka 120a6e
                      this->m_up.getFx()->getTimeRegion().contains(frame));
Shinya Kitaoka 120a6e
  const bool down_is = (this->m_down.isConnected() &&
Shinya Kitaoka 120a6e
                        this->m_down.getFx()->getTimeRegion().contains(frame));
Shinya Kitaoka 120a6e
  /* ------ 両方とも切断の時処理しない ---------------------- */
Shinya Kitaoka 120a6e
  if (!up_is && !down_is) {
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ up接続かつdown切断の時 -------------------------- */
Shinya Kitaoka 120a6e
  if (up_is && !down_is) {
Shinya Kitaoka 120a6e
    this->m_up->dryCompute(rect, frame, rs);
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ down接続時 -------------------------------------- */
Shinya Kitaoka 120a6e
  if (down_is) {
Shinya Kitaoka 120a6e
    this->m_down->dryCompute(rect, frame, rs);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ up切断時 ---------------------------------------- */
Shinya Kitaoka 120a6e
  if (!up_is) {
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /* ------ tileのgeometryを計算する ------------------------ */
Shinya Kitaoka 120a6e
  TRectD upBBox;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (upComputesWholeTile) {
Shinya Kitaoka 120a6e
    upBBox = rect;
Shinya Kitaoka 120a6e
  } else {
Shinya Kitaoka 120a6e
    this->m_up->getBBox(frame, upBBox, rs);
Shinya Kitaoka 120a6e
    upBBox *= rect;
Shinya Kitaoka 120a6e
    makeRectCoherent(upBBox, rect.getP00());
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if ((upBBox.getLx() > 0.5) && (upBBox.getLy() > 0.5)) {
Shinya Kitaoka 120a6e
    this->m_up->dryCompute(upBBox, frame, rs);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
#include <sstream> /* std::ostringstream */</sstream>
Toshihiro Shimizu 890ddd
#include "igs_color_blend.h"
Shinya Kitaoka 120a6e
namespace {
Toshihiro Shimizu 890ddd
template <class class="" q="" t,=""></class>
Shinya Kitaoka 120a6e
void tmpl_(TRasterPT<t> dn_ras_out, const TRasterPT<t> &up_ras,</t></t>
Shinya Kitaoka 120a6e
           const double up_opacity, const bool clipping_mask_sw) {
Shinya Kitaoka 120a6e
  double maxi = static_cast<double>(T::maxChannelValue);  // 255or65535</double>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  assert(dn_ras_out->getSize() == up_ras->getSize());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  for (int yy = 0; yy < dn_ras_out->getLy(); ++yy) {
Shinya Kitaoka 120a6e
    T *out_pix             = dn_ras_out->pixels(yy);
Shinya Kitaoka 120a6e
    const T *const out_end = out_pix + dn_ras_out->getLx();
Shinya Kitaoka 120a6e
    const T *up_pix        = up_ras->pixels(yy);
Shinya Kitaoka 120a6e
    for (; out_pix < out_end; ++out_pix, ++up_pix) {
Shinya Kitaoka 120a6e
      double upr = static_cast<double>(up_pix->r) / maxi;</double>
Shinya Kitaoka 120a6e
      double upg = static_cast<double>(up_pix->g) / maxi;</double>
Shinya Kitaoka 120a6e
      double upb = static_cast<double>(up_pix->b) / maxi;</double>
Shinya Kitaoka 120a6e
      double upa = static_cast<double>(up_pix->m) / maxi;</double>
Shinya Kitaoka 120a6e
      double dnr = static_cast<double>(out_pix->r) / maxi;</double>
Shinya Kitaoka 120a6e
      double dng = static_cast<double>(out_pix->g) / maxi;</double>
Shinya Kitaoka 120a6e
      double dnb = static_cast<double>(out_pix->b) / maxi;</double>
Shinya Kitaoka 120a6e
      double dna = static_cast<double>(out_pix->m) / maxi;</double>
Shinya Kitaoka 120a6e
      igs::color::cross_dissolve(
Shinya Kitaoka 120a6e
          dnr, dng, dnb, dna, upr, upg, upb, upa,
Shinya Kitaoka 120a6e
          clipping_mask_sw ? up_opacity * dna : up_opacity);
Shinya Kitaoka 120a6e
      out_pix->r = static_cast<q>(dnr * (maxi + 0.999999));</q>
Shinya Kitaoka 120a6e
      out_pix->g = static_cast<q>(dng * (maxi + 0.999999));</q>
Shinya Kitaoka 120a6e
      out_pix->b = static_cast<q>(dnb * (maxi + 0.999999));</q>
Shinya Kitaoka 120a6e
      out_pix->m = static_cast<q>(dna * (maxi + 0.999999));</q>
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void fx_(TRasterP &dn_ras_out, const TRasterP &up_ras, const TPoint &pos,
Shinya Kitaoka 120a6e
         const double up_opacity, const bool clipping_mask_sw) {
Shinya Kitaoka 120a6e
  /* 交差したエリアを処理するようにする、いるのか??? */
Shinya Kitaoka 120a6e
  TRect outRect(dn_ras_out->getBounds());
Shinya Kitaoka 120a6e
  TRect upRect(up_ras->getBounds() + pos);
Shinya Kitaoka 120a6e
  TRect intersection = outRect * upRect;
Shinya Kitaoka 120a6e
  if (intersection.isEmpty()) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRasterP cRout = dn_ras_out->extract(intersection);
Shinya Kitaoka 120a6e
  TRect rr       = intersection - pos;
Shinya Kitaoka 120a6e
  TRasterP cRup  = up_ras->extract(rr);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TRaster32P rout32 = cRout, rup32 = cRup;
Shinya Kitaoka 120a6e
  TRaster64P rout64 = cRout, rup64 = cRup;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (rout32 && rup32) {
Shinya Kitaoka 120a6e
    tmpl_<tpixel32, uchar="">(rout32, rup32, up_opacity, clipping_mask_sw);</tpixel32,>
Shinya Kitaoka 120a6e
  } else if (rout64 && rup64) {
Shinya Kitaoka 120a6e
    tmpl_<tpixel64, ushort="">(rout64, rup64, up_opacity, clipping_mask_sw);</tpixel64,>
Shinya Kitaoka 120a6e
  } else {
Shinya Kitaoka 120a6e
    throw TRopException("unsupported pixel type");
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Shinya Kitaoka 120a6e
void ino_blend_cross_dissolve::doCompute(TTile &tile, double frame,
Shinya Kitaoka 120a6e
                                         const TRenderSettings &rs) {
Shinya Kitaoka 120a6e
  /* ------ 画像生成 ---------------------------------------- */
Shinya Kitaoka 120a6e
  TRasterP dn_ras, up_ras;
Shinya Kitaoka 120a6e
  this->computeUpAndDown(tile, frame, rs, dn_ras, up_ras);
Shinya Kitaoka 120a6e
  if (!dn_ras || !up_ras) {
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ 動作パラメータを得る ---------------------------- */
Shinya Kitaoka 120a6e
  const double up_opacity =
Shinya Kitaoka 120a6e
      this->m_opacity->getValue(frame) / ino::param_range();
Shinya Kitaoka 120a6e
  /* ------ (app_begin)log記憶 ------------------------------ */
Shinya Kitaoka 120a6e
  const bool log_sw = ino::log_enable_sw();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (log_sw) {
Shinya Kitaoka 120a6e
    std::ostringstream os;
Shinya Kitaoka 120a6e
    os << "params"
Shinya Kitaoka 120a6e
       << "  up_opacity " << up_opacity << "   dn_tile w " << dn_ras->getLx()
Shinya Kitaoka 120a6e
       << "  wrap " << dn_ras->getWrap() << "  h " << dn_ras->getLy()
Shinya Kitaoka 120a6e
       << "  pixbits " << ino::pixel_bits(dn_ras) << "   up_tile w "
Shinya Kitaoka 120a6e
       << up_ras->getLx() << "  wrap " << up_ras->getWrap() << "  h "
Shinya Kitaoka 120a6e
       << up_ras->getLy() << "  pixbits " << ino::pixel_bits(up_ras)
Shinya Kitaoka 120a6e
       << "   frame " << frame;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ fx処理 ------------------------------------------ */
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    if (dn_ras) {
Shinya Kitaoka 120a6e
      dn_ras->lock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (up_ras) {
Shinya Kitaoka 120a6e
      up_ras->lock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    fx_(dn_ras, up_ras, TPoint(), up_opacity,
Shinya Kitaoka 120a6e
        this->m_clipping_mask->getValue());
Shinya Kitaoka 120a6e
    if (up_ras) {
Shinya Kitaoka 120a6e
      up_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (dn_ras) {
Shinya Kitaoka 120a6e
      dn_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  /* ------ error処理 --------------------------------------- */
Shinya Kitaoka 120a6e
  catch (std::exception &e) {
Shinya Kitaoka 120a6e
    if (up_ras) {
Shinya Kitaoka 120a6e
      up_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (dn_ras) {
Shinya Kitaoka 120a6e
      dn_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (log_sw) {
Shinya Kitaoka 120a6e
      std::string str("exception <");
Shinya Kitaoka 120a6e
      str += e.what();
Shinya Kitaoka 120a6e
      str += '>';
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    throw;
Shinya Kitaoka 120a6e
  } catch (...) {
Shinya Kitaoka 120a6e
    if (up_ras) {
Shinya Kitaoka 120a6e
      up_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (dn_ras) {
Shinya Kitaoka 120a6e
      dn_ras->unlock();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    if (log_sw) {
Shinya Kitaoka 120a6e
      std::string str("other exception");
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    throw;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}