mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert: implement (de)interleave with existing functions
This commit is contained in:
		
							parent
							
								
									afd8e8823e
								
							
						
					
					
						commit
						06b1cf8663
					
				
					 6 changed files with 96 additions and 120 deletions
				
			
		| 
						 | 
					@ -271,18 +271,18 @@ static void test_s24_32_f32(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void test_interleave(void)
 | 
					static void test_interleave(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	run_test("test_interleave_8", "c", false, true, conv_interleave_8_c);
 | 
						run_test("test_8d_to_8", "c", false, true, conv_8d_to_8_c);
 | 
				
			||||||
	run_test("test_interleave_16", "c", false, true, conv_interleave_16_c);
 | 
						run_test("test_16d_to_16", "c", false, true, conv_16d_to_16_c);
 | 
				
			||||||
	run_test("test_interleave_24", "c", false, true, conv_interleave_24_c);
 | 
						run_test("test_24d_to_24", "c", false, true, conv_24d_to_24_c);
 | 
				
			||||||
	run_test("test_interleave_32", "c", false, true, conv_interleave_32_c);
 | 
						run_test("test_32d_to_32", "c", false, true, conv_32d_to_32_c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void test_deinterleave(void)
 | 
					static void test_deinterleave(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	run_test("test_deinterleave_8", "c", true, false, conv_deinterleave_8_c);
 | 
						run_test("test_8_to_8d", "c", true, false, conv_8_to_8d_c);
 | 
				
			||||||
	run_test("test_deinterleave_16", "c", true, false, conv_deinterleave_16_c);
 | 
						run_test("test_16_to_16d", "c", true, false, conv_16_to_16d_c);
 | 
				
			||||||
	run_test("test_deinterleave_24", "c", true, false, conv_deinterleave_24_c);
 | 
						run_test("test_24_to_24d", "c", true, false, conv_24_to_24d_c);
 | 
				
			||||||
	run_test("test_deinterleave_32", "c", true, false, conv_deinterleave_32_c);
 | 
						run_test("test_32_to_32d", "c", true, false, conv_32_to_32d_c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int compare_func(const void *_a, const void *_b)
 | 
					static int compare_func(const void *_a, const void *_b)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,8 +55,8 @@ MAKE_COPY(24);
 | 
				
			||||||
MAKE_COPY(32);
 | 
					MAKE_COPY(32);
 | 
				
			||||||
MAKE_COPY(64);
 | 
					MAKE_COPY(64);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_D_TO_D_F(src,stype,dst,dtype,func) 				\
 | 
					#define MAKE_D_TO_D_F(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
void conv_ ##src## d_to_ ##dst## d_c(struct convert *conv,			\
 | 
					void conv_ ##sname## d_to_ ##dname## d_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -69,11 +69,11 @@ void conv_ ##src## d_to_ ##dst## d_c(struct convert *conv,			\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_D_TO_D(src,stype,dst,dtype,func) 					\
 | 
					#define MAKE_D_TO_D(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
	MAKE_D_TO_D_F(src,stype,dst,dtype, d[j] = func (s[j])) 			\
 | 
						MAKE_D_TO_D_F(sname,stype,dname,dtype, d[j] = func (s[j])) 		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_I_TO_I_F(src,stype,dst,dtype,func) 				\
 | 
					#define MAKE_I_TO_I_F(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
void conv_ ##src## _to_ ##dst## _c(struct convert *conv,			\
 | 
					void conv_ ##sname## _to_ ##dname## _c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -85,11 +85,11 @@ void conv_ ##src## _to_ ##dst## _c(struct convert *conv,			\
 | 
				
			||||||
		func;								\
 | 
							func;								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_I_TO_I(src,stype,dst,dtype,func) 					\
 | 
					#define MAKE_I_TO_I(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
	MAKE_I_TO_I_F(src,stype,dst,dtype, d[j] = func (s[j])) 			\
 | 
						MAKE_I_TO_I_F(sname,stype,dname,dtype, d[j] = func (s[j])) 		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_I_TO_D_F(src,stype,dst,dtype,func) 				\
 | 
					#define MAKE_I_TO_D_F(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
void conv_ ##src## _to_ ##dst## d_c(struct convert *conv,			\
 | 
					void conv_ ##sname## _to_ ##dname## d_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -102,11 +102,11 @@ void conv_ ##src## _to_ ##dst## d_c(struct convert *conv,			\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_I_TO_D(src,stype,dst,dtype,func) 					\
 | 
					#define MAKE_I_TO_D(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
	MAKE_I_TO_D_F(src,stype,dst,dtype, d[i][j] = func (*s++)) 		\
 | 
						MAKE_I_TO_D_F(sname,stype,dname,dtype, d[i][j] = func (*s++)) 		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_D_TO_I_F(src,stype,dst,dtype,func) 				\
 | 
					#define MAKE_D_TO_I_F(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
void conv_ ##src## d_to_ ##dst## _c(struct convert *conv,			\
 | 
					void conv_ ##sname## d_to_ ##dname## _c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -119,8 +119,8 @@ void conv_ ##src## d_to_ ##dst## _c(struct convert *conv,			\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_D_TO_I(src,stype,dst,dtype,func) 					\
 | 
					#define MAKE_D_TO_I(sname,stype,dname,dtype,func) 				\
 | 
				
			||||||
	MAKE_D_TO_I_F(src,stype,dst,dtype, *d++ = func (s[i][j])) 		\
 | 
						MAKE_D_TO_I_F(sname,stype,dname,dtype, *d++ = func (s[i][j])) 		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* to f32 */
 | 
					/* to f32 */
 | 
				
			||||||
MAKE_D_TO_D(u8, uint8_t, f32, float, U8_TO_F32);
 | 
					MAKE_D_TO_D(u8, uint8_t, f32, float, U8_TO_F32);
 | 
				
			||||||
| 
						 | 
					@ -253,8 +253,8 @@ static inline void update_dither_c(struct convert *conv, uint32_t n_samples)
 | 
				
			||||||
		dither[n] = lcnoise(state) * scale;
 | 
							dither[n] = lcnoise(state) * scale;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_D_dither_F(dst,dtype,func) 					\
 | 
					#define MAKE_D_dither_F(dname,dtype,func) 					\
 | 
				
			||||||
void conv_f32d_to_ ##dst## d_dither_c(struct convert *conv,			\
 | 
					void conv_f32d_to_ ##dname## d_dither_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -272,11 +272,11 @@ void conv_f32d_to_ ##dst## d_dither_c(struct convert *conv,			\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_D_dither(dst,dtype,func) 						\
 | 
					#define MAKE_D_dither(dname,dtype,func) 					\
 | 
				
			||||||
	MAKE_D_dither_F(dst,dtype, d[j] = func (s[j], dither[k]))		\
 | 
						MAKE_D_dither_F(dname,dtype, d[j] = func (s[j], dither[k]))		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_I_dither_F(dst,dtype,func) 					\
 | 
					#define MAKE_I_dither_F(dname,dtype,func) 					\
 | 
				
			||||||
void conv_f32d_to_ ##dst## _dither_c(struct convert *conv,			\
 | 
					void conv_f32d_to_ ##dname## _dither_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -294,8 +294,8 @@ void conv_f32d_to_ ##dst## _dither_c(struct convert *conv,			\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_I_dither(dst,dtype,func) 						\
 | 
					#define MAKE_I_dither(dname,dtype,func) 					\
 | 
				
			||||||
	MAKE_I_dither_F(dst,dtype, *d++ = func (s[i][j], dither[k]))		\
 | 
						MAKE_I_dither_F(dname,dtype, *d++ = func (s[i][j], dither[k]))		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAKE_D_dither(u8, uint8_t, F32_TO_U8_D);
 | 
					MAKE_D_dither(u8, uint8_t, F32_TO_U8_D);
 | 
				
			||||||
MAKE_I_dither(u8, uint8_t, F32_TO_U8_D);
 | 
					MAKE_I_dither(u8, uint8_t, F32_TO_U8_D);
 | 
				
			||||||
| 
						 | 
					@ -335,8 +335,8 @@ MAKE_I_dither(s24_32s, int32_t, F32_TO_S24_32S_D);
 | 
				
			||||||
#define F32_TO_S16_SH(s,sh,d)	SHAPER5(int16_t, s, S16_SCALE, 0, sh, S16_MIN, S16_MAX, d)
 | 
					#define F32_TO_S16_SH(s,sh,d)	SHAPER5(int16_t, s, S16_SCALE, 0, sh, S16_MIN, S16_MAX, d)
 | 
				
			||||||
#define F32_TO_S16S_SH(s,sh,d)	bswap_16(F32_TO_S16_SH(s,sh,d))
 | 
					#define F32_TO_S16S_SH(s,sh,d)	bswap_16(F32_TO_S16_SH(s,sh,d))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_D_shaped_F(dst,dtype,func) 					\
 | 
					#define MAKE_D_shaped_F(dname,dtype,func) 					\
 | 
				
			||||||
void conv_f32d_to_ ##dst## d_shaped_c(struct convert *conv,			\
 | 
					void conv_f32d_to_ ##dname## d_shaped_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -357,11 +357,11 @@ void conv_f32d_to_ ##dst## d_shaped_c(struct convert *conv,			\
 | 
				
			||||||
		sh->idx = idx;							\
 | 
							sh->idx = idx;							\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_D_shaped(dst,dtype,func) 						\
 | 
					#define MAKE_D_shaped(dname,dtype,func) 					\
 | 
				
			||||||
	MAKE_D_shaped_F(dst,dtype, d[j] = func (s[j], sh, dither[k]))		\
 | 
						MAKE_D_shaped_F(dname,dtype, d[j] = func (s[j], sh, dither[k]))		\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_I_shaped_F(dst,dtype,func) 					\
 | 
					#define MAKE_I_shaped_F(dname,dtype,func) 					\
 | 
				
			||||||
void conv_f32d_to_ ##dst## _shaped_c(struct convert *conv,			\
 | 
					void conv_f32d_to_ ##dname## _shaped_c(struct convert *conv,			\
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
							void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
				
			||||||
                uint32_t n_samples)						\
 | 
					                uint32_t n_samples)						\
 | 
				
			||||||
{										\
 | 
					{										\
 | 
				
			||||||
| 
						 | 
					@ -383,8 +383,8 @@ void conv_f32d_to_ ##dst## _shaped_c(struct convert *conv,			\
 | 
				
			||||||
		sh->idx = idx;							\
 | 
							sh->idx = idx;							\
 | 
				
			||||||
	}									\
 | 
						}									\
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define MAKE_I_shaped(dst,dtype,func) 						\
 | 
					#define MAKE_I_shaped(dname,dtype,func) 						\
 | 
				
			||||||
	MAKE_I_shaped_F(dst,dtype, d[j*n_channels] = func (s[j], sh, dither[k]))		\
 | 
						MAKE_I_shaped_F(dname,dtype, d[j*n_channels] = func (s[j], sh, dither[k]))	\
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAKE_D_shaped(u8, uint8_t, F32_TO_U8_SH);
 | 
					MAKE_D_shaped(u8, uint8_t, F32_TO_U8_SH);
 | 
				
			||||||
MAKE_I_shaped(u8, uint8_t, F32_TO_U8_SH);
 | 
					MAKE_I_shaped(u8, uint8_t, F32_TO_U8_SH);
 | 
				
			||||||
| 
						 | 
					@ -395,20 +395,8 @@ MAKE_I_shaped(s16, int16_t, F32_TO_S16_SH);
 | 
				
			||||||
MAKE_I_shaped(s16s, uint16_t, F32_TO_S16S_SH);
 | 
					MAKE_I_shaped(s16s, uint16_t, F32_TO_S16S_SH);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_DEINTERLEAVE(size,type,func)					\
 | 
					#define MAKE_DEINTERLEAVE(size,type,func)					\
 | 
				
			||||||
void conv_deinterleave_ ##size## _c(struct convert *conv,			\
 | 
						MAKE_I_TO_D_F(size,type,size,type,func)
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
					#define DEINTERLEAVE_COPY	(d[i][j] = *s++)
 | 
				
			||||||
		uint32_t n_samples)						\
 | 
					 | 
				
			||||||
{										\
 | 
					 | 
				
			||||||
	const type *s = src[0];							\
 | 
					 | 
				
			||||||
	type **d = (type **) dst;						\
 | 
					 | 
				
			||||||
	uint32_t i, j, n_channels = conv->n_channels;				\
 | 
					 | 
				
			||||||
	for (j = 0; j < n_samples; j++) {					\
 | 
					 | 
				
			||||||
		for (i = 0; i < n_channels; i++) {				\
 | 
					 | 
				
			||||||
			func;							\
 | 
					 | 
				
			||||||
		}								\
 | 
					 | 
				
			||||||
	}									\
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#define DEINTERLEAVE_COPY		(d[i][j] = *s++)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAKE_DEINTERLEAVE(8, uint8_t, DEINTERLEAVE_COPY);
 | 
					MAKE_DEINTERLEAVE(8, uint8_t, DEINTERLEAVE_COPY);
 | 
				
			||||||
MAKE_DEINTERLEAVE(16, uint16_t, DEINTERLEAVE_COPY);
 | 
					MAKE_DEINTERLEAVE(16, uint16_t, DEINTERLEAVE_COPY);
 | 
				
			||||||
| 
						 | 
					@ -418,19 +406,7 @@ MAKE_DEINTERLEAVE(32s, uint32_t, d[i][j] = bswap_32(*s++));
 | 
				
			||||||
MAKE_DEINTERLEAVE(64, uint64_t, DEINTERLEAVE_COPY);
 | 
					MAKE_DEINTERLEAVE(64, uint64_t, DEINTERLEAVE_COPY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAKE_INTERLEAVE(size,type,func)						\
 | 
					#define MAKE_INTERLEAVE(size,type,func)						\
 | 
				
			||||||
void conv_interleave_ ##size## _c(struct convert *conv,				\
 | 
						MAKE_D_TO_I_F(size,type,size,type,func)
 | 
				
			||||||
		void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],	\
 | 
					 | 
				
			||||||
		uint32_t n_samples)						\
 | 
					 | 
				
			||||||
{										\
 | 
					 | 
				
			||||||
	const type **s = (const type **) src;					\
 | 
					 | 
				
			||||||
	type *d = dst[0];							\
 | 
					 | 
				
			||||||
	uint32_t i, j, n_channels = conv->n_channels;				\
 | 
					 | 
				
			||||||
	for (j = 0; j < n_samples; j++) {					\
 | 
					 | 
				
			||||||
		for (i = 0; i < n_channels; i++) {				\
 | 
					 | 
				
			||||||
			func;							\
 | 
					 | 
				
			||||||
		}								\
 | 
					 | 
				
			||||||
	}									\
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#define INTERLEAVE_COPY		(*d++ = s[i][j])
 | 
					#define INTERLEAVE_COPY		(*d++ = s[i][j])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAKE_INTERLEAVE(8, uint8_t, INTERLEAVE_COPY);
 | 
					MAKE_INTERLEAVE(8, uint8_t, INTERLEAVE_COPY);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -699,7 +699,7 @@ conv_interleave_32_4s_sse2(void *data, void * SPA_RESTRICT dst, const void * SPA
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
conv_interleave_32_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
					conv_32d_to_32_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
				
			||||||
		uint32_t n_samples)
 | 
							uint32_t n_samples)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int32_t *d = dst[0];
 | 
						int32_t *d = dst[0];
 | 
				
			||||||
| 
						 | 
					@ -797,7 +797,7 @@ conv_interleave_32s_4s_sse2(void *data, void * SPA_RESTRICT dst, const void * SP
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
conv_interleave_32s_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
					conv_32sd_to_32s_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
				
			||||||
		uint32_t n_samples)
 | 
							uint32_t n_samples)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int32_t *d = dst[0];
 | 
						int32_t *d = dst[0];
 | 
				
			||||||
| 
						 | 
					@ -878,7 +878,7 @@ conv_deinterleave_32_4s_sse2(void *data, void * SPA_RESTRICT dst[], const void *
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
conv_deinterleave_32_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
					conv_32_to_32d_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
				
			||||||
		uint32_t n_samples)
 | 
							uint32_t n_samples)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const float *s = src[0];
 | 
						const float *s = src[0];
 | 
				
			||||||
| 
						 | 
					@ -965,7 +965,7 @@ conv_deinterleave_32s_4s_sse2(void *data, void * SPA_RESTRICT dst[], const void
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
conv_deinterleave_32s_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
					conv_32s_to_32sd_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
 | 
				
			||||||
		uint32_t n_samples)
 | 
							uint32_t n_samples)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const float *s = src[0];
 | 
						const float *s = src[0];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,22 +96,22 @@ static struct conv_info conv_table[] =
 | 
				
			||||||
	MAKE(F32, F32, 0, conv_copy32_c),
 | 
						MAKE(F32, F32, 0, conv_copy32_c),
 | 
				
			||||||
	MAKE(F32P, F32P, 0, conv_copy32d_c),
 | 
						MAKE(F32P, F32P, 0, conv_copy32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(F32, F32P, 0, conv_deinterleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(F32, F32P, 0, conv_32_to_32d_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(F32, F32P, 0, conv_deinterleave_32_c),
 | 
						MAKE(F32, F32P, 0, conv_32_to_32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(F32P, F32, 0, conv_interleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(F32P, F32, 0, conv_32d_to_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(F32P, F32, 0, conv_interleave_32_c),
 | 
						MAKE(F32P, F32, 0, conv_32d_to_32_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(F32_OE, F32P, 0, conv_deinterleave_32s_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(F32_OE, F32P, 0, conv_32s_to_32sd_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(F32_OE, F32P, 0, conv_deinterleave_32s_c),
 | 
						MAKE(F32_OE, F32P, 0, conv_32s_to_32sd_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(F32P, F32_OE, 0, conv_interleave_32s_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(F32P, F32_OE, 0, conv_32sd_to_32s_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(F32P, F32_OE, 0, conv_interleave_32s_c),
 | 
						MAKE(F32P, F32_OE, 0, conv_32sd_to_32s_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MAKE(U32, F32, 0, conv_u32_to_f32_c),
 | 
						MAKE(U32, F32, 0, conv_u32_to_f32_c),
 | 
				
			||||||
	MAKE(U32, F32P, 0, conv_u32_to_f32d_c),
 | 
						MAKE(U32, F32P, 0, conv_u32_to_f32d_c),
 | 
				
			||||||
| 
						 | 
					@ -287,14 +287,14 @@ static struct conv_info conv_table[] =
 | 
				
			||||||
	/* u8 */
 | 
						/* u8 */
 | 
				
			||||||
	MAKE(U8, U8, 0, conv_copy8_c),
 | 
						MAKE(U8, U8, 0, conv_copy8_c),
 | 
				
			||||||
	MAKE(U8P, U8P, 0, conv_copy8d_c),
 | 
						MAKE(U8P, U8P, 0, conv_copy8d_c),
 | 
				
			||||||
	MAKE(U8, U8P, 0, conv_deinterleave_8_c),
 | 
						MAKE(U8, U8P, 0, conv_8_to_8d_c),
 | 
				
			||||||
	MAKE(U8P, U8, 0, conv_interleave_8_c),
 | 
						MAKE(U8P, U8, 0, conv_8d_to_8_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* s8 */
 | 
						/* s8 */
 | 
				
			||||||
	MAKE(S8, S8, 0, conv_copy8_c),
 | 
						MAKE(S8, S8, 0, conv_copy8_c),
 | 
				
			||||||
	MAKE(S8P, S8P, 0, conv_copy8d_c),
 | 
						MAKE(S8P, S8P, 0, conv_copy8d_c),
 | 
				
			||||||
	MAKE(S8, S8P, 0, conv_deinterleave_8_c),
 | 
						MAKE(S8, S8P, 0, conv_8_to_8d_c),
 | 
				
			||||||
	MAKE(S8P, S8, 0, conv_interleave_8_c),
 | 
						MAKE(S8P, S8, 0, conv_8d_to_8_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* alaw */
 | 
						/* alaw */
 | 
				
			||||||
	MAKE(ALAW, ALAW, 0, conv_copy8_c),
 | 
						MAKE(ALAW, ALAW, 0, conv_copy8_c),
 | 
				
			||||||
| 
						 | 
					@ -304,44 +304,44 @@ static struct conv_info conv_table[] =
 | 
				
			||||||
	/* s16 */
 | 
						/* s16 */
 | 
				
			||||||
	MAKE(S16, S16, 0, conv_copy16_c),
 | 
						MAKE(S16, S16, 0, conv_copy16_c),
 | 
				
			||||||
	MAKE(S16P, S16P, 0, conv_copy16d_c),
 | 
						MAKE(S16P, S16P, 0, conv_copy16d_c),
 | 
				
			||||||
	MAKE(S16, S16P, 0, conv_deinterleave_16_c),
 | 
						MAKE(S16, S16P, 0, conv_16_to_16d_c),
 | 
				
			||||||
	MAKE(S16P, S16, 0, conv_interleave_16_c),
 | 
						MAKE(S16P, S16, 0, conv_16d_to_16_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* s32 */
 | 
						/* s32 */
 | 
				
			||||||
	MAKE(S32, S32, 0, conv_copy32_c),
 | 
						MAKE(S32, S32, 0, conv_copy32_c),
 | 
				
			||||||
	MAKE(S32P, S32P, 0, conv_copy32d_c),
 | 
						MAKE(S32P, S32P, 0, conv_copy32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(S32, S32P, 0, conv_deinterleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(S32, S32P, 0, conv_32_to_32d_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(S32, S32P, 0, conv_deinterleave_32_c),
 | 
						MAKE(S32, S32P, 0, conv_32_to_32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(S32P, S32, 0, conv_interleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(S32P, S32, 0, conv_32d_to_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(S32P, S32, 0, conv_interleave_32_c),
 | 
						MAKE(S32P, S32, 0, conv_32d_to_32_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* s24 */
 | 
						/* s24 */
 | 
				
			||||||
	MAKE(S24, S24, 0, conv_copy24_c),
 | 
						MAKE(S24, S24, 0, conv_copy24_c),
 | 
				
			||||||
	MAKE(S24P, S24P, 0, conv_copy24d_c),
 | 
						MAKE(S24P, S24P, 0, conv_copy24d_c),
 | 
				
			||||||
	MAKE(S24, S24P, 0, conv_deinterleave_24_c),
 | 
						MAKE(S24, S24P, 0, conv_24_to_24d_c),
 | 
				
			||||||
	MAKE(S24P, S24, 0, conv_interleave_24_c),
 | 
						MAKE(S24P, S24, 0, conv_24d_to_24_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* s24_32 */
 | 
						/* s24_32 */
 | 
				
			||||||
	MAKE(S24_32, S24_32, 0, conv_copy32_c),
 | 
						MAKE(S24_32, S24_32, 0, conv_copy32_c),
 | 
				
			||||||
	MAKE(S24_32P, S24_32P, 0, conv_copy32d_c),
 | 
						MAKE(S24_32P, S24_32P, 0, conv_copy32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(S24_32, S24_32P, 0, conv_deinterleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(S24_32, S24_32P, 0, conv_32_to_32d_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(S24_32, S24_32P, 0, conv_deinterleave_32_c),
 | 
						MAKE(S24_32, S24_32P, 0, conv_32_to_32d_c),
 | 
				
			||||||
#if defined (HAVE_SSE2)
 | 
					#if defined (HAVE_SSE2)
 | 
				
			||||||
	MAKE(S24_32P, S24_32, 0, conv_interleave_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
						MAKE(S24_32P, S24_32, 0, conv_32d_to_32_sse2, SPA_CPU_FLAG_SSE2),
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	MAKE(S24_32P, S24_32, 0, conv_interleave_32_c),
 | 
						MAKE(S24_32P, S24_32, 0, conv_32d_to_32_c),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* F64 */
 | 
						/* F64 */
 | 
				
			||||||
	MAKE(F64, F64, 0, conv_copy64_c),
 | 
						MAKE(F64, F64, 0, conv_copy64_c),
 | 
				
			||||||
	MAKE(F64P, F64P, 0, conv_copy64d_c),
 | 
						MAKE(F64P, F64P, 0, conv_copy64d_c),
 | 
				
			||||||
	MAKE(F64, F64P, 0, conv_deinterleave_64_c),
 | 
						MAKE(F64, F64P, 0, conv_64_to_64d_c),
 | 
				
			||||||
	MAKE(F64P, F64, 0, conv_interleave_64_c),
 | 
						MAKE(F64P, F64, 0, conv_64d_to_64_c),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#undef MAKE
 | 
					#undef MAKE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -383,20 +383,20 @@ DEFINE_FUNCTION(f32_to_f64, c);
 | 
				
			||||||
DEFINE_FUNCTION(f32_to_f64d, c);
 | 
					DEFINE_FUNCTION(f32_to_f64d, c);
 | 
				
			||||||
DEFINE_FUNCTION(f32d_to_f64, c);
 | 
					DEFINE_FUNCTION(f32d_to_f64, c);
 | 
				
			||||||
DEFINE_FUNCTION(f32d_to_f64s, c);
 | 
					DEFINE_FUNCTION(f32d_to_f64s, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_8, c);
 | 
					DEFINE_FUNCTION(8_to_8d, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_16, c);
 | 
					DEFINE_FUNCTION(16_to_16d, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_24, c);
 | 
					DEFINE_FUNCTION(24_to_24d, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_32, c);
 | 
					DEFINE_FUNCTION(32_to_32d, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_32s, c);
 | 
					DEFINE_FUNCTION(32s_to_32sd, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_64, c);
 | 
					DEFINE_FUNCTION(64_to_64d, c);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_64s, c);
 | 
					DEFINE_FUNCTION(64s_to_64sd, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_8, c);
 | 
					DEFINE_FUNCTION(8d_to_8, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_16, c);
 | 
					DEFINE_FUNCTION(16d_to_16, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_24, c);
 | 
					DEFINE_FUNCTION(24d_to_24, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_32, c);
 | 
					DEFINE_FUNCTION(32d_to_32, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_32s, c);
 | 
					DEFINE_FUNCTION(32sd_to_32s, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_64, c);
 | 
					DEFINE_FUNCTION(64d_to_64, c);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_64s, c);
 | 
					DEFINE_FUNCTION(64sd_to_64s, c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(HAVE_NEON)
 | 
					#if defined(HAVE_NEON)
 | 
				
			||||||
DEFINE_FUNCTION(s16_to_f32d_2, neon);
 | 
					DEFINE_FUNCTION(s16_to_f32d_2, neon);
 | 
				
			||||||
| 
						 | 
					@ -414,10 +414,10 @@ DEFINE_FUNCTION(f32_to_s16, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(f32d_to_s16_2, sse2);
 | 
					DEFINE_FUNCTION(f32d_to_s16_2, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(f32d_to_s16, sse2);
 | 
					DEFINE_FUNCTION(f32d_to_s16, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(f32d_to_s16d, sse2);
 | 
					DEFINE_FUNCTION(f32d_to_s16d, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_32, sse2);
 | 
					DEFINE_FUNCTION(32_to_32d, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(deinterleave_32s, sse2);
 | 
					DEFINE_FUNCTION(32s_to_32sd, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_32, sse2);
 | 
					DEFINE_FUNCTION(32d_to_32, sse2);
 | 
				
			||||||
DEFINE_FUNCTION(interleave_32s, sse2);
 | 
					DEFINE_FUNCTION(32sd_to_32s, sse2);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#if defined(HAVE_SSSE3)
 | 
					#if defined(HAVE_SSSE3)
 | 
				
			||||||
DEFINE_FUNCTION(s24_to_f32d, ssse3);
 | 
					DEFINE_FUNCTION(s24_to_f32d, ssse3);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,19 +81,19 @@ static void run_test(const char *name,
 | 
				
			||||||
		tp[0] = temp_in;
 | 
							tp[0] = temp_in;
 | 
				
			||||||
		switch(in_size) {
 | 
							switch(in_size) {
 | 
				
			||||||
		case 1:
 | 
							case 1:
 | 
				
			||||||
			conv_interleave_8_c(&conv, tp, ip, N_SAMPLES);
 | 
								conv_8d_to_8_c(&conv, tp, ip, N_SAMPLES);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case 2:
 | 
							case 2:
 | 
				
			||||||
			conv_interleave_16_c(&conv, tp, ip, N_SAMPLES);
 | 
								conv_16d_to_16_c(&conv, tp, ip, N_SAMPLES);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case 3:
 | 
							case 3:
 | 
				
			||||||
			conv_interleave_24_c(&conv, tp, ip, N_SAMPLES);
 | 
								conv_24d_to_24_c(&conv, tp, ip, N_SAMPLES);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case 4:
 | 
							case 4:
 | 
				
			||||||
			conv_interleave_32_c(&conv, tp, ip, N_SAMPLES);
 | 
								conv_32d_to_32_c(&conv, tp, ip, N_SAMPLES);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case 8:
 | 
							case 8:
 | 
				
			||||||
			conv_interleave_64_c(&conv, tp, ip, N_SAMPLES);
 | 
								conv_64d_to_64_c(&conv, tp, ip, N_SAMPLES);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			fprintf(stderr, "unknown size %zd\n", in_size);
 | 
								fprintf(stderr, "unknown size %zd\n", in_size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue