From 1830d70f92accf609d478ba9ca5f14363e4f5cd0 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 14 Feb 2023 20:56:39 -0500 Subject: [PATCH] cwVectOps.h : Added interleave() and deinterleave() --- cwVectOps.h | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/cwVectOps.h b/cwVectOps.h index 704726a..a5e402c 100644 --- a/cwVectOps.h +++ b/cwVectOps.h @@ -51,19 +51,23 @@ namespace cw // Move,fill,copy // template< typename T0, typename T1 > - void copy( T0* v0, const T1* v1, unsigned n ) + void copy( T0* v0, const T1* v1, unsigned n ) { for(unsigned i=0; i - void fill( T0* v, unsigned n, const T1& value=0 ) + void fill( T0* v, unsigned n, const T1& value, unsigned dst_offset ) { - for(unsigned i=0; i + void fill( T0* v, unsigned n, const T1& value=0 ) + { fill(v,n,value,1); } + template< typename T > void zero( T* v, unsigned n ) { fill(v,n,0); } @@ -342,6 +346,31 @@ namespace cw //================================================================================================================== // Signal Processing // + template< typename T0, typename T1 > + void interleave( T0* v0, const T1* v1, unsigned frameN, unsigned dstChCnt ) + { + // v0[] = { LRLRLRLR ], v1[] = [ LLLLRRRR ] + for(unsigned k=0; k + void deinterleave( T0* v0, const T1* v1, unsigned frameN, unsigned srcChCnt ) + { + // v0[] = [ LLLLRRRR ], v1[] = { LRLRLRLR ] + for(unsigned k=0; k unsigned phasor( T* y, unsigned n, T srate, T hz, unsigned init_idx=0 )