示例#1
0
convolve_filter<T>::convolve_filter(const univector<T>& data, size_t block_size)
    : fft(2 * next_poweroftwo(block_size)), size(data.size()), block_size(next_poweroftwo(block_size)),
      temp(fft.temp_size),
      segments((data.size() + next_poweroftwo(block_size) - 1) / next_poweroftwo(block_size)),
      ir_segments((data.size() + next_poweroftwo(block_size) - 1) / next_poweroftwo(block_size)),
      input_position(0), position(0)
{
    set_data(data);
}
示例#2
0
univector<T> correlate(const univector_ref<const T>& src1, const univector_ref<const T>& src2)
{
    const size_t size                = next_poweroftwo(src1.size() + src2.size() - 1);
    univector<complex<T>> src1padded = src1;
    univector<complex<T>> src2padded = reverse(src2);
    src1padded.resize(size, 0);
    src2padded.resize(size, 0);
    dft_plan_ptr<T> dft = dft_cache::instance().get(ctype_t<T>(), size);
    univector<u8> temp(dft->temp_size);
    dft->execute(src1padded, src1padded, temp);
    dft->execute(src2padded, src2padded, temp);
    src1padded = src1padded * src2padded;
    dft->execute(src1padded, src1padded, temp, true);
    const T invsize = reciprocal<T>(size);
    return truncate(real(src1padded), src1.size() + src2.size() - 1) * invsize;
}
示例#3
0
文件: simd.hpp 项目: kfrlib/kfr
constexpr size_t alignment()
{
    return const_min(size_t(platform<>::native_vector_alignment), next_poweroftwo(sizeof(T) * N));
}
示例#4
0
convolve_filter<T>::convolve_filter(size_t size, size_t block_size)
    : fft(2 * next_poweroftwo(block_size)), size(size), block_size(block_size), temp(fft.temp_size),
      segments((size + block_size - 1) / block_size)
{
}
示例#5
0
CMT_INLINE T horizontal_impl(const vec<T, N>& value, ReduceFn&& reduce)
{
    const T initial = reduce(initialvalue<T>());
    return horizontal_impl(widen<next_poweroftwo(N)>(value, initial), std::forward<ReduceFn>(reduce));
}