diff --git a/spa/plugins/audioconvert/fmt-ops-c.c b/spa/plugins/audioconvert/fmt-ops-c.c index f43677c0c..9d2d171b2 100644 --- a/spa/plugins/audioconvert/fmt-ops-c.c +++ b/spa/plugins/audioconvert/fmt-ops-c.c @@ -164,8 +164,7 @@ MAKE_D_TO_D(f64, double, f32, float, (float)); MAKE_I_TO_I(f64, double, f32, float, (float)); MAKE_I_TO_D(f64, double, f32, float, (float)); MAKE_D_TO_I(f64, double, f32, float, (float)); -MAKE_I_TO_D(f64s, double, f32, float, bswap_64); /* FIXME */ - +MAKE_I_TO_D(f64s, uint64_t, f32, float, (float)F64S_TO_F64); /* from f32 */ MAKE_D_TO_D(f32, float, u8, uint8_t, F32_TO_U8); @@ -221,7 +220,7 @@ MAKE_D_TO_D(f32, float, f64, double, (double)); MAKE_I_TO_I(f32, float, f64, double, (double)); MAKE_I_TO_D(f32, float, f64, double, (double)); MAKE_D_TO_I(f32, float, f64, double, (double)); -MAKE_D_TO_I(f32, float, f64s, double, bswap_32); /* FIXME */ +MAKE_D_TO_I(f32, float, f64s, uint64_t, F64_TO_F64S); static inline int32_t @@ -370,22 +369,22 @@ MAKE_D_shaped(s16, int16_t, F32_TO_S16_SH); MAKE_I_shaped(s16, int16_t, F32_TO_S16_SH); MAKE_I_shaped(s16s, uint16_t, F32_TO_S16S_SH); -#define MAKE_DEINTERLEAVE(size,type,func) \ - MAKE_I_TO_D(size,type,size,type,func) +#define MAKE_DEINTERLEAVE(size1,size2, type,func) \ + MAKE_I_TO_D(size1,type,size2,type,func) -MAKE_DEINTERLEAVE(8, uint8_t, (uint8_t)); -MAKE_DEINTERLEAVE(16, uint16_t, (uint16_t)); -MAKE_DEINTERLEAVE(24, uint24_t, (uint24_t)); -MAKE_DEINTERLEAVE(32, uint32_t, (uint32_t)); -MAKE_DEINTERLEAVE(32s, uint32_t, bswap_32); -MAKE_DEINTERLEAVE(64, uint64_t, (uint64_t)); +MAKE_DEINTERLEAVE(8, 8, uint8_t, (uint8_t)); +MAKE_DEINTERLEAVE(16, 16, uint16_t, (uint16_t)); +MAKE_DEINTERLEAVE(24, 24, uint24_t, (uint24_t)); +MAKE_DEINTERLEAVE(32, 32, uint32_t, (uint32_t)); +MAKE_DEINTERLEAVE(32s, 32, uint32_t, bswap_32); +MAKE_DEINTERLEAVE(64, 64, uint64_t, (uint64_t)); -#define MAKE_INTERLEAVE(size,type,func) \ - MAKE_D_TO_I(size,type,size,type,func) +#define MAKE_INTERLEAVE(size1,size2,type,func) \ + MAKE_D_TO_I(size1,type,size2,type,func) -MAKE_INTERLEAVE(8, uint8_t, (uint8_t)); -MAKE_INTERLEAVE(16, uint16_t, (uint16_t)); -MAKE_INTERLEAVE(24, uint24_t, (uint24_t)); -MAKE_INTERLEAVE(32, uint32_t, (uint32_t)); -MAKE_INTERLEAVE(32s, uint32_t, bswap_32); -MAKE_INTERLEAVE(64, uint64_t, (uint64_t)); +MAKE_INTERLEAVE(8, 8, uint8_t, (uint8_t)); +MAKE_INTERLEAVE(16, 16, uint16_t, (uint16_t)); +MAKE_INTERLEAVE(24, 24, uint24_t, (uint24_t)); +MAKE_INTERLEAVE(32, 32, uint32_t, (uint32_t)); +MAKE_INTERLEAVE(32, 32s, uint32_t, bswap_32); +MAKE_INTERLEAVE(64, 64, uint64_t, (uint64_t)); diff --git a/spa/plugins/audioconvert/fmt-ops-sse2.c b/spa/plugins/audioconvert/fmt-ops-sse2.c index ff1f671c1..5b4f06324 100644 --- a/spa/plugins/audioconvert/fmt-ops-sse2.c +++ b/spa/plugins/audioconvert/fmt-ops-sse2.c @@ -823,7 +823,7 @@ conv_interleave_32s_4s_sse2(void *data, void * SPA_RESTRICT dst, const void * SP } void -conv_32sd_to_32s_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], +conv_32d_to_32s_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_samples) { int32_t *d = dst[0]; @@ -991,7 +991,7 @@ conv_deinterleave_32s_4s_sse2(void *data, void * SPA_RESTRICT dst[], const void } void -conv_32s_to_32sd_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], +conv_32s_to_32d_sse2(struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_samples) { const float *s = src[0]; diff --git a/spa/plugins/audioconvert/fmt-ops.c b/spa/plugins/audioconvert/fmt-ops.c index e21872249..f6e324708 100644 --- a/spa/plugins/audioconvert/fmt-ops.c +++ b/spa/plugins/audioconvert/fmt-ops.c @@ -105,13 +105,13 @@ static struct conv_info conv_table[] = MAKE(F32P, F32, 0, conv_32d_to_32_c), #if defined (HAVE_SSE2) - MAKE(F32_OE, F32P, 0, conv_32s_to_32sd_sse2, SPA_CPU_FLAG_SSE2), + MAKE(F32_OE, F32P, 0, conv_32s_to_32d_sse2, SPA_CPU_FLAG_SSE2), #endif - MAKE(F32_OE, F32P, 0, conv_32s_to_32sd_c), + MAKE(F32_OE, F32P, 0, conv_32s_to_32d_c), #if defined (HAVE_SSE2) - MAKE(F32P, F32_OE, 0, conv_32sd_to_32s_sse2, SPA_CPU_FLAG_SSE2), + MAKE(F32P, F32_OE, 0, conv_32d_to_32s_sse2, SPA_CPU_FLAG_SSE2), #endif - MAKE(F32P, F32_OE, 0, conv_32sd_to_32s_c), + MAKE(F32P, F32_OE, 0, conv_32d_to_32s_c), MAKE(U32, F32, 0, conv_u32_to_f32_c), MAKE(U32, F32P, 0, conv_u32_to_f32d_c), diff --git a/spa/plugins/audioconvert/fmt-ops.h b/spa/plugins/audioconvert/fmt-ops.h index 9d40c9d29..5359ee388 100644 --- a/spa/plugins/audioconvert/fmt-ops.h +++ b/spa/plugins/audioconvert/fmt-ops.h @@ -181,6 +181,16 @@ static inline int24_t bswap_s24(int24_t src) return (int24_t) { .v1 = src.v3, .v2 = src.v2, .v3 = src.v1 }; } +#define F32_TO_F32S(v) \ + bswap_32((union { uint32_t i; float f; }){ .f = (v) }.i) +#define F32S_TO_F32(v) \ + ((union { uint32_t i; float f; }){ .i = bswap_32(v) }.f) + +#define F64_TO_F64S(v) \ + bswap_32((union { uint64_t i; double d; }){ .d = (v) }.i) +#define F64S_TO_F64(v) \ + ((union { uint64_t i; double d; }){ .i = bswap_32(v) }.d) + #define NS_MAX 8 #define NS_MASK (NS_MAX-1) @@ -371,14 +381,14 @@ DEFINE_FUNCTION(8_to_8d, c); DEFINE_FUNCTION(16_to_16d, c); DEFINE_FUNCTION(24_to_24d, c); DEFINE_FUNCTION(32_to_32d, c); -DEFINE_FUNCTION(32s_to_32sd, c); +DEFINE_FUNCTION(32s_to_32d, c); DEFINE_FUNCTION(64_to_64d, c); DEFINE_FUNCTION(64s_to_64sd, c); DEFINE_FUNCTION(8d_to_8, c); DEFINE_FUNCTION(16d_to_16, c); DEFINE_FUNCTION(24d_to_24, c); DEFINE_FUNCTION(32d_to_32, c); -DEFINE_FUNCTION(32sd_to_32s, c); +DEFINE_FUNCTION(32d_to_32s, c); DEFINE_FUNCTION(64d_to_64, c); DEFINE_FUNCTION(64sd_to_64s, c); @@ -399,9 +409,9 @@ DEFINE_FUNCTION(f32d_to_s16_2, sse2); DEFINE_FUNCTION(f32d_to_s16, sse2); DEFINE_FUNCTION(f32d_to_s16d, sse2); DEFINE_FUNCTION(32_to_32d, sse2); -DEFINE_FUNCTION(32s_to_32sd, sse2); +DEFINE_FUNCTION(32s_to_32d, sse2); DEFINE_FUNCTION(32d_to_32, sse2); -DEFINE_FUNCTION(32sd_to_32s, sse2); +DEFINE_FUNCTION(32d_to_32s, sse2); #endif #if defined(HAVE_SSSE3) DEFINE_FUNCTION(s24_to_f32d, ssse3);