85 using hwy::HWY_NAMESPACE::StoreInterleaved2 ;
86 using hwy::HWY_NAMESPACE::StoreInterleaved3 ;
87 using hwy::HWY_NAMESPACE::StoreInterleaved4 ;
88 using hwy::HWY_NAMESPACE::LoadInterleaved2 ;
89 using hwy::HWY_NAMESPACE::LoadInterleaved3 ;
90 using hwy::HWY_NAMESPACE::LoadInterleaved4 ;
117template <
typename T ,
size_t N ,
size_t K ,
size_t ... seq >
120 const vigra::TinyVector < T , N > * _data ,
122 Vc::index_sequence < seq ... > )
124 const Vc::InterleavedMemoryWrapper < const vigra::TinyVector < T , N > ,
125 Vc::Vector<T> > data ( _data ) ;
142 /
sizeof ( Vc::Vector < T > ) } ;
144 typedef typename vigra::TinyVector < Vc::Vector < T > , nv > as_v1_type ;
145 typedef typename vigra::TinyVector < as_v1_type , N > as_vn_type ;
147 as_vn_type & as_vn =
reinterpret_cast < as_vn_type &
> ( v ) ;
152 for (
size_t k = 0 ; k < K ; k++ )
154 Vc::tie ( as_vn [ seq ] [ k ] ... )
155 = ( data [ sz + k * Vc::Vector<T>::size() ] ) ;
159template <
typename T ,
size_t N ,
size_t K ,
size_t ... seq >
162 vigra::TinyVector < T , N > * _data ,
164 Vc::index_sequence < seq ... > )
166 Vc::InterleavedMemoryWrapper < vigra::TinyVector < T , N > ,
167 Vc::Vector<T> > data ( _data ) ;
180 /
sizeof ( Vc::Vector < T > ) } ;
182 typedef typename vigra::TinyVector < Vc::Vector < T > , nv > as_v1_type ;
183 typedef typename vigra::TinyVector < as_v1_type , N > as_vn_type ;
185 const as_vn_type & as_vn =
reinterpret_cast < const as_vn_type &
> ( v ) ;
190 for (
size_t k = 0 ; k < K ; k++ )
192 data [ sz + k * Vc::Vector<T>::size() ]
193 = Vc::tie ( as_vn [ seq ] [ k ] ... ) ;
219template <
typename ele_type ,
int chn , std::
size_t vsz >
220void bunch (
const vigra::TinyVector < ele_type , chn > *
const & src ,
225 index_type ix = index_type::IndexesFromZero() * stride * chn ;
227 for (
int d = 0 ; d < chn ; d++ )
228 trg[d].gather ( ((ele_type*)src) + d , ix ) ;
235template <
typename ele_type , std::
size_t vsz >
236void bunch (
const vigra::TinyVector < ele_type , 1 > *
const & src ,
241 trg[0].load ( (
const ele_type*) src ) ;
249template <
typename ele_type ,
int chn , std::
size_t vsz >
250typename std::enable_if < vsz % Vc::Vector<ele_type>::size() == 0 > :: type
251bunch (
const vigra::TinyVector < ele_type , chn > *
const & src ,
256 enum { K = vsz / Vc::Vector<ele_type>::size() } ;
258 detail::fetch < ele_type , chn , K >
259 ( trg , src , 0 , Vc::make_index_sequence<chn>() ) ;
266template <
typename ele_type ,
int chn , std::
size_t vsz >
268 vigra::TinyVector < ele_type , chn > *
const & trg ,
272 index_type ix = index_type::IndexesFromZero() * stride * chn ;
274 for (
int d = 0 ; d < chn ; d++ )
275 src[d].scatter ( ((ele_type*)trg) + d , ix ) ;
278template <
typename ele_type , std::
size_t vsz >
280 vigra::TinyVector < ele_type , 1 > *
const & trg ,
284 src[0].store ( (ele_type*) trg ) ;
287template <
typename ele_type ,
int chn , std::
size_t vsz >
288typename std::enable_if < vsz % Vc::Vector<ele_type>::size() == 0 > :: type
290 vigra::TinyVector < ele_type , chn > *
const & trg ,
294 enum { K = vsz / Vc::Vector<ele_type>::size() } ;
296 detail::stash < ele_type , chn , K >
297 ( src , trg , 0 , Vc::make_index_sequence<chn>() ) ;
309template <
typename target_type ,
typename ele_type >
310void bunch (
const vigra::TinyVector < ele_type , 1 > *
const & src ,
315 trg[0].load (
reinterpret_cast < const ele_type *
const > ( src ) ) ;
320template <
typename ele_type ,
typename source_type >
321void fluff (
const source_type & src ,
322 vigra::TinyVector < ele_type , 1 > *
const & trg ,
326 src[0].store (
reinterpret_cast < ele_type *
const > ( trg ) ) ;
329template <
typename target_type ,
typename ele_type ,
int chn >
330void _bunch (
const vigra::TinyVector < ele_type , chn > *
const & src ,
334 const ele_type * p_src =
reinterpret_cast < const ele_type *
const > ( src ) ;
335 std::size_t estride = stride * chn ;
336 for (
int ch = 0 ; ch < chn ; ch++ )
338 trg[ch].rgather ( p_src , estride ) ;
343template <
typename ele_type ,
typename source_type ,
int chn >
345 vigra::TinyVector < ele_type , chn > *
const & trg ,
349 ele_type * p_trg =
reinterpret_cast < ele_type *
const > ( trg ) ;
350 std::size_t estride = stride * chn ;
351 for (
int ch = 0 ; ch < chn ; ch++ )
353 src[ch].rscatter ( p_trg , estride ) ;
358template <
typename target_type ,
typename ele_type ,
int chn >
359void bunch (
const vigra::TinyVector < ele_type , chn > *
const & src ,
363 _bunch ( src , trg , stride ) ;
366template <
typename ele_type ,
typename source_type ,
int chn >
367void fluff (
const source_type & src ,
368 vigra::TinyVector < ele_type , chn > *
const & trg ,
372 _fluff ( src , trg , stride ) ;
383template <
typename T , std::
size_t vsz >
384void fluff (
const vigra::TinyVector
386 vigra::TinyVector < T , 2 > *
const & trg ,
392 T * p_trg = (T*) trg ;
393 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += src[0].L() )
395 StoreInterleaved2 ( src[0].yield ( i ) ,
399 p_trg += 2 * src[0].L() ;
404 _fluff ( src , trg , stride ) ;
408template <
typename T , std::
size_t vsz >
409void fluff (
const vigra::TinyVector
411 vigra::TinyVector < T , 3 > *
const & trg ,
417 T * p_trg = (T*) trg ;
418 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += src[0].L() )
420 StoreInterleaved3 ( src[0].yield ( i ) ,
425 p_trg += 3 * src[0].L() ;
430 _fluff ( src , trg , stride ) ;
434template <
typename T , std::
size_t vsz >
435void fluff (
const vigra::TinyVector
437 vigra::TinyVector < T , 4 > *
const & trg ,
443 T * p_trg = (T*) trg ;
444 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += src[0].L() )
446 StoreInterleaved4 ( src[0].yield ( i ) ,
452 p_trg += 4 * src[0].L() ;
457 _fluff ( src , trg , stride ) ;
461template <
typename T , std::
size_t vsz >
462void bunch (
const vigra::TinyVector < T , 2 > *
const & src ,
467 const T * p_src = (T*) src ;
472 const T * p_src = (
const T*) src ;
474 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += trg[0].L() )
476 LoadInterleaved2 ( D() , p_src , c0 , c1 ) ;
477 trg[0].take ( i , c0 ) ;
478 trg[1].take ( i , c1 ) ;
479 p_src += 2 * trg[0].L() ;
484 _bunch ( src , trg , stride ) ;
488template <
typename T , std::
size_t vsz >
489void bunch (
const vigra::TinyVector < T , 3 > *
const & src ,
494 const T * p_src = (T*) src ;
499 const T * p_src = (
const T*) src ;
501 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += trg[0].L() )
503 LoadInterleaved3 ( D() , p_src , c0 , c1 , c2 ) ;
504 trg[0].take ( i , c0 ) ;
505 trg[1].take ( i , c1 ) ;
506 trg[2].take ( i , c2 ) ;
507 p_src += 3 * trg[0].L() ;
512 _bunch ( src , trg , stride ) ;
516template <
typename T , std::
size_t vsz >
517void bunch (
const vigra::TinyVector < T , 4 > *
const & src ,
522 const T * p_src = (T*) src ;
527 const T * p_src = (
const T*) src ;
528 vec_t c0 , c1 , c2 , c3 ;
529 for ( std::size_t n = 0 , i = 0 ; n < vsz ; ++i , n += trg[0].L() )
531 LoadInterleaved4 ( D() , p_src , c0 , c1 , c2 , c3 ) ;
532 trg[0].take ( i , c0 ) ;
533 trg[1].take ( i , c1 ) ;
534 trg[2].take ( i , c2 ) ;
535 trg[3].take ( i , c3 ) ;
536 p_src += 4 * trg[0].L() ;
541 _bunch ( src , trg , stride ) ;
vigra::MultiArray< 2, pixel_type > target_type
typename vector_traits< T, N > ::type simdized_type
this alias is used as a shorthand to pick the vectorized type for a given type T and a size N from 'v...
void fetch(vigra::TinyVector< vspline::simdized_type< T, K *Vc::Vector< T >::size() >, N > &v, const vigra::TinyVector< T, N > *_data, const size_t &sz, Vc::index_sequence< seq ... >)
void stash(const vigra::TinyVector< vspline::simdized_type< T, K *Vc::Vector< T >::size() >, N > &v, vigra::TinyVector< T, N > *_data, const size_t &sz, Vc::index_sequence< seq ... >)
void _fluff(const source_type &src, vigra::TinyVector< ele_type, chn > *const &trg, const ic_type &stride)
void bunch(const vigra::TinyVector< ele_type, chn > *const &src, vigra::TinyVector< vspline::vc_simd_type< ele_type, vsz >, chn > &trg, const ic_type &stride)
bunch picks up data from interleaved, strided memory and stores them in a data type representing a pa...
void _bunch(const vigra::TinyVector< ele_type, chn > *const &src, target_type &trg, const ic_type &stride)
void fluff(const vigra::TinyVector< vspline::vc_simd_type< ele_type, vsz >, chn > &src, vigra::TinyVector< ele_type, chn > *const &trg, const ic_type &stride)
reverse operation: a package of vectorized data is written to interleaved, strided memory....
class template vc_simd_type provides a fixed-size SIMD type. This implementation of vspline::vc_simd_...