Esempio n. 1
0
void PitchFlockViewer::plot_beat ()
{
  const size_t I = synth().size;
  const size_t X = Rectangle::width();
  const size_t Y = Rectangle::height();

  const float * restrict phase_x = synth().get_phase_x();
  const float * restrict phase_y = synth().get_phase_y();
  float * restrict image = m_beat_image;

  complex force = synth().get_force_snapshot();
  float beat = abs(force) * m_force_gain.update(abs(force));

  if (m_image_mutex.try_lock()) {

    for (size_t i = 0; i < I; ++i) {
      float x = wrap(atan2f(phase_y[i], phase_x[i]) / (2 * M_PI)) * X;
      float y = (i + 0.5f) / I * Y;

      BilinearInterpolate(x, X, y, Y).imax(image, beat);
    }

    m_image_mutex.unlock();
  }
}
Esempio n. 2
0
const typename ImageDataType::PixelType
ImageBase::BilinearInterpolator<ImageDataType>::operator () () const
{
    const size_t pmin_x = static_cast<size_t>( m_pmin.x() );
    const size_t pmin_y = static_cast<size_t>( m_pmin.y() );
    const size_t pmax_x = static_cast<size_t>( m_pmax.x() );
    const size_t pmax_y = static_cast<size_t>( m_pmax.y() );

    typename ImageDataType::PixelType p1 = m_reference_image->pixel( pmin_x, pmin_y );
    typename ImageDataType::PixelType p2 = m_reference_image->pixel( pmin_x, pmax_y );
    typename ImageDataType::PixelType p3 = m_reference_image->pixel( pmax_x, pmin_y );
    typename ImageDataType::PixelType p4 = m_reference_image->pixel( pmax_x, pmax_y );

    return( BilinearInterpolate( p1, p2, p3, p4, m_rate.x(), m_rate.y() ) );
}