PixelR operator () (const PixelRef& p) const {
        PixelR result;
        static_transform(p,result, channel_pow_t<typename channel_type<PixelRef>::type,
						                         n,
												 typename channel_type<PixelR>::type>());
        return result;
    }
 PixelR operator () (const PixelRef& p,
                     const Scalar& s) const {
     PixelR result;
     static_transform(p,result,
                        std::bind2nd(channel_divides_scalar_t<typename channel_type<PixelRef>::type,
                                                              Scalar,
                                                              typename channel_type<PixelR>::type>(),s));
     return result;
 }
 PixelR operator() (const PixelRef1& p1,
                    const PixelRef2& p2) const {
     PixelR result;
     static_transform(p1,p2,result,
                        channel_minus_t<typename channel_type<PixelRef1>::type,
                                        typename channel_type<PixelRef2>::type,
                                        typename channel_type<PixelR>::type>());
     return result;
 }
Example #4
0
    planar_pixel_iterator& operator=(P* pix) {
        function_requires<PixelsCompatibleConcept<P,value_type> >();
        static_transform(*pix,*this, address_of());

        // PERFORMANCE_CHECK: Compare to this:
        //this->template semantic_at_c<0>()=&pix->template semantic_at_c<0>();
        //this->template semantic_at_c<1>()=&pix->template semantic_at_c<1>();
        //this->template semantic_at_c<2>()=&pix->template semantic_at_c<2>();
        return *this;
    }
Example #5
0
void x_gradient(const SrcView& src, const DstView& dst) {
    typedef typename channel_type<DstView>::type dst_channel_t;

    for (int y=0; y<src.height(); ++y) {
        typename SrcView::x_iterator src_it = src.row_begin(y);
        typename DstView::x_iterator dst_it = dst.row_begin(y);

        for (int x=1; x<src.width()-1; ++x)
            static_transform(src_it[x-1], src_it[x+1], dst_it[x], 
                               halfdiff_cast_channels<dst_channel_t>());
    }
}
    planar_frame_iterator& operator= (P* pix)
    {
	/*
	  TODO:
	  It seems that the following statements are optimized away by
	  GCC in some strange cases...
	 */
	boost::function_requires<FramesCompatibleConcept<P, value_type> >();
	static_transform (*pix, *this, address_of ());

	/*
	  TODO:
	  Performance compare to this:
	  this->template semantic_at_c<0>()=&pix->template
	  semantic_at_c<0>();
	  this->template semantic_at_c<1>()=&pix->template
	  semantic_at_c<1>();
	  this->template semantic_at_c<2>()=&pix->template
	  semantic_at_c<2>();
	*/
        return *this;
    }
Example #7
0
inline void memunit_advance(planar_pixel_iterator<IC,C>& p, std::ptrdiff_t diff) { 
    static_transform(p, p, memunit_advance_fn<IC>(diff));
}
Example #8
0
 void advance(ptrdiff_t d)   { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric<ChannelPtr,ptrdiff_t>(),d)); }
Example #9
0
 void decrement()            { static_transform(*this,*this,detail::dec<ChannelPtr>()); }
Example #10
0
void node_sampler::do_update (const node0* caller, int caller_port_type, int caller_port)
{
    audio_buffer* out = get_output<audio_buffer> (node0::LINK_AUDIO, OUT_A_OUTPUT);
    const sample_buffer* trig = get_input<sample_buffer> (node0::LINK_CONTROL, IN_C_TRIGGER);
    const sample* trig_buf = trig ? (const sample*) &const_range(*trig)[0] : 0;
    link_envelope trig_env =  get_in_envelope (LINK_CONTROL, IN_C_TRIGGER);

    /* Read the data. */
    size_t start = 0;
    size_t end = get_info ().block_size;

    if (m_reader)
    {
	while (start < get_info ().block_size) {
	    if (m_restart) {
		if (trig_buf && trig_buf[start] != 0.0f) {
		    restart();
		    m_restart = false;
		}
	    }

	    if (trig)
		end = synth::find_hill (const_range (*trig), start);

	    read(*out, start, end);

	    float env_val = (float) (audio_sample) trig_env.update (end - start);
	    if (env_val == 1.0f && trig_buf && trig_buf[end - 1] == 0.0f)
		m_restart = true;

	    start = end;
	}
    } else
	fill_frames (range (*out), audio_frame (0));

    /* Set amplitude. */
    transform_frames (
        range (*out), range (*out),
        [&] (audio_frame in) -> audio_frame {
            static_transform (in, in, [&] (audio_sample in) -> audio_sample {
                    return in * this->m_param_ampl;
                });
            return in;
        });

    /* Apply trigger envelope. */
    if (trig_buf) {
	for (size_t i = 0; i < get_info ().num_channels; ++i) {
	    sample* buf = (sample*) &range (*out)[0][i];
	    int n_samp = get_info ().block_size;
	    trig_buf = (const sample*) &const_range (*trig)[0];
	    trig_env = get_in_envelope (LINK_CONTROL, IN_C_TRIGGER);

	    while (n_samp--) {
		float env_val = (float) (audio_sample) trig_env.update();
		*buf = *buf * ((1.0f - env_val) + (env_val * *trig_buf));
		++buf;
		++trig_buf;
	    }
	}
    }

}
    void decrement ()
    {
	static_transform (*this, *this, detail::dec<SamplePtr>());
    }