diff options
author | Rui Nuno Capela <rncbc@rncbc.org> | 2019-02-08 21:22:53 +0000 |
---|---|---|
committer | Filipe Coelho <falktx@falktx.com> | 2019-02-08 22:22:53 +0100 |
commit | 05bc08c64e9747ae7e9db75b9f667564d3784380 (patch) | |
tree | f373965a8996845e70fe065abdbb3ebbbc08f83b | |
parent | a752bfaa618457ea9ad366794f0751cc96ba2578 (diff) | |
download | jack2-05bc08c64e9747ae7e9db75b9f667564d3784380.tar.gz |
memops-alsa_bad_sound-fix-1 (#426)
* Revert "oss_driver: Use float to S32 conversion if requested"
This reverts commit c5a0f5ea1cf4c29f35e76b600043bef95147186f.
* Revert "alsa_in/out: Use float to S32 conversion if requested"
This reverts commit 148c8d8e6acf3242bcc27b62f7f51bbdeee6472b.
* Revert "alsa_driver: Use float to S32 conversion if requested"
This reverts commit d017e1fffeb15c9baee46220642dda5030409a02.
* Revert "memops: Provide function for float to S32 conversion"
This reverts commit bb99e09b99ab2c71f9a91ca0fb8cbb996df5dbc6.
* Revert "memops: Align S24LE and S32LE to float conversion"
This reverts commit b4ea23df6a16180a3d686cefffe7dd91fcbc9a27.
* Revert "memops: Provide function for S32 to float conversion"
This reverts commit 244fc27e29d8523acbd6a166a8a11bab969a84b7.
* Revert "memops: Align float to S24LE and S32LE conversion"
This reverts commit 4455fe020ca890d8c6b24f89a7bf91f9044b9d33.
* Revert "memops: Remove not used conversion macros"
This reverts commit a82f3f2fb44e236e5bf3b207349ca000cd01185c.
* Revert "memops: Use right-aligned S24LE to float conversion"
This reverts commit e75325431353919b1917d96a047a2a195ce01c00.
* Revert "memops: Use right-aligned float to S24LE conversion"
This reverts commit 831163e51640aad2fbda7710c44bc406f167df85.
-rw-r--r-- | common/memops.c | 213 | ||||
-rw-r--r-- | common/memops.h | 4 | ||||
-rw-r--r-- | example-clients/alsa_in.c | 4 | ||||
-rw-r--r-- | example-clients/alsa_out.c | 4 | ||||
-rw-r--r-- | linux/alsa/alsa_driver.c | 33 | ||||
-rw-r--r-- | solaris/oss/JackBoomerDriver.cpp | 4 | ||||
-rw-r--r-- | solaris/oss/JackOSSAdapter.cpp | 4 | ||||
-rw-r--r-- | solaris/oss/JackOSSDriver.cpp | 4 |
8 files changed, 103 insertions, 167 deletions
diff --git a/common/memops.c b/common/memops.c index 5648a96b..6e8d273a 100644 --- a/common/memops.c +++ b/common/memops.c @@ -29,7 +29,6 @@ #include <memory.h> #include <stdlib.h> #include <stdint.h> -#include <stdbool.h> #include <limits.h> #ifdef __linux__ #include <endian.h> @@ -74,9 +73,8 @@ So, for now (October 2008) we use 2^(N-1)-1 as the scaling factor. */ -#define SAMPLE_32BIT_SCALING 0x7FFFFFFF -#define SAMPLE_24BIT_SCALING 8388607 -#define SAMPLE_16BIT_SCALING 32767 +#define SAMPLE_24BIT_SCALING 8388607.0f +#define SAMPLE_16BIT_SCALING 32767.0f /* these are just values to use if the floating point value was out of range @@ -85,6 +83,8 @@ #define SAMPLE_24BIT_MAX 8388607 #define SAMPLE_24BIT_MIN -8388607 +#define SAMPLE_24BIT_MAX_F 8388607.0f +#define SAMPLE_24BIT_MIN_F -8388607.0f #define SAMPLE_16BIT_MAX 32767 #define SAMPLE_16BIT_MIN -32767 @@ -128,15 +128,26 @@ (d) = f_round ((s));\ } -#define float_32(s, d, scale) \ +#define float_24u32(s, d) \ if ((s) <= NORMALIZED_FLOAT_MIN) {\ - (d) = -scale;\ + (d) = SAMPLE_24BIT_MIN << 8;\ } else if ((s) >= NORMALIZED_FLOAT_MAX) {\ - (d) = scale;\ + (d) = SAMPLE_24BIT_MAX << 8;\ } else {\ - (d) = f_round ((s) * scale);\ + (d) = f_round ((s) * SAMPLE_24BIT_SCALING) << 8;\ } +/* call this when "s" has already been scaled (e.g. when dithering) + */ + +#define float_24u32_scaled(s, d)\ + if ((s) <= SAMPLE_24BIT_MIN_F) {\ + (d) = SAMPLE_24BIT_MIN << 8;\ + } else if ((s) >= SAMPLE_24BIT_MAX_F) { \ + (d) = SAMPLE_24BIT_MAX << 8; \ + } else {\ + (d) = f_round ((s)) << 8; \ + } #define float_24(s, d) \ if ((s) <= NORMALIZED_FLOAT_MIN) {\ @@ -147,6 +158,18 @@ (d) = f_round ((s) * SAMPLE_24BIT_SCALING);\ } +/* call this when "s" has already been scaled (e.g. when dithering) + */ + +#define float_24_scaled(s, d)\ + if ((s) <= SAMPLE_24BIT_MIN_F) {\ + (d) = SAMPLE_24BIT_MIN;\ + } else if ((s) >= SAMPLE_24BIT_MAX_F) { \ + (d) = SAMPLE_24BIT_MAX; \ + } else {\ + (d) = f_round ((s)); \ + } + #if defined (__SSE2__) && !defined (__sun__) @@ -182,13 +205,13 @@ static inline float32x4_t clip(float32x4_t s, float32x4_t min, float32x4_t max) return vminq_f32(max, vmaxq_f32(s, min)); } -static inline int32x4_t float_32_neon(float32x4_t s, const int32_t scaling) +static inline int32x4_t float_24_neon(float32x4_t s) { const float32x4_t upper_bound = vdupq_n_f32(NORMALIZED_FLOAT_MAX); const float32x4_t lower_bound = vdupq_n_f32(NORMALIZED_FLOAT_MIN); float32x4_t clipped = clip(s, lower_bound, upper_bound); - float32x4_t scaled = vmulq_f32(clipped, vdupq_n_f32(scaling)); + float32x4_t scaled = vmulq_f32(clipped, vdupq_n_f32(SAMPLE_24BIT_SCALING)); return vcvtq_s32_f32(scaled); } @@ -242,9 +265,7 @@ void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsign S - sample is a jack_default_audio_sample_t, currently (October 2008) a 32 bit floating point value Ss - like S but reverse endian from the host CPU - 32 - sample is an signed 32 bit integer value - 32s - like 32 but reverse endian from the host CPU - 32u24 - sample is an signed 32 bit integer value, but data is in lower 24 bits only + 32u24 - sample is an signed 32 bit integer value, but data is in upper 24 bits only 32u24s - like 32u24 but reverse endian from the host CPU 24 - sample is an signed 24 bit integer value 24s - like 24 but reverse endian from the host CPU @@ -258,7 +279,7 @@ void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsign /* functions for native integer sample data */ -static inline void sample_move_d32scal_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state, const int32_t scaling) +void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) { #if defined (__ARM_NEON__) || defined (__ARM_NEON) unsigned long unrolled = nsamples / 4; @@ -266,18 +287,19 @@ static inline void sample_move_d32scal_sSs (char *dst, jack_default_audio_sample while (unrolled--) { float32x4_t samples = vld1q_f32(src); - int32x4_t converted = float_32_neon(samples, scaling); - converted = vreinterpretq_s32_u8(vrev32q_u8(vreinterpretq_u8_s32(converted))); + int32x4_t converted = float_24_neon(samples); + int32x4_t shifted = vshlq_n_s32(converted, 8); + shifted = vreinterpretq_s32_u8(vrev32q_u8(vreinterpretq_u8_s32(shifted))); switch(dst_skip) { case 4: - vst1q_s32((int32_t*)dst, converted); + vst1q_s32((int32_t*)dst, shifted); break; default: - vst1q_lane_s32((int32_t*)(dst), converted, 0); - vst1q_lane_s32((int32_t*)(dst+dst_skip), converted, 1); - vst1q_lane_s32((int32_t*)(dst+2*dst_skip), converted, 2); - vst1q_lane_s32((int32_t*)(dst+3*dst_skip), converted, 3); + vst1q_lane_s32((int32_t*)(dst), shifted, 0); + vst1q_lane_s32((int32_t*)(dst+dst_skip), shifted, 1); + vst1q_lane_s32((int32_t*)(dst+2*dst_skip), shifted, 2); + vst1q_lane_s32((int32_t*)(dst+3*dst_skip), shifted, 3); break; } dst += 4*dst_skip; @@ -289,7 +311,7 @@ static inline void sample_move_d32scal_sSs (char *dst, jack_default_audio_sample while (nsamples--) { - float_32 (*src, z, scaling); + float_24u32 (*src, z); #if __BYTE_ORDER == __LITTLE_ENDIAN dst[0]=(char)(z>>24); @@ -305,23 +327,12 @@ static inline void sample_move_d32scal_sSs (char *dst, jack_default_audio_sample dst += dst_skip; src++; } -} - -void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) -{ - sample_move_d32scal_sSs (dst, src, nsamples, dst_skip, state, SAMPLE_24BIT_SCALING); -} - -void sample_move_d32_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) -{ - sample_move_d32scal_sSs (dst, src, nsamples, dst_skip, state, SAMPLE_32BIT_SCALING); -} - +} -static inline void sample_move_d32scal_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state, const int32_t scaling) +void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) { #if defined (__SSE2__) && !defined (__sun__) - __m128 int_max = _mm_set1_ps(scaling); + __m128 int_max = _mm_set1_ps(SAMPLE_24BIT_MAX_F); __m128 int_min = _mm_sub_ps(_mm_setzero_ps(), int_max); __m128 factor = int_max; @@ -334,18 +345,19 @@ static inline void sample_move_d32scal_sS (char *dst, jack_default_audio_sample_ __m128 clipped = clip(scaled, int_min, int_max); __m128i y = _mm_cvttps_epi32(clipped); + __m128i shifted = _mm_slli_epi32(y, 8); #ifdef __SSE4_1__ - *(int32_t*)dst = _mm_extract_epi32(y, 0); - *(int32_t*)(dst+dst_skip) = _mm_extract_epi32(y, 1); - *(int32_t*)(dst+2*dst_skip) = _mm_extract_epi32(y, 2); - *(int32_t*)(dst+3*dst_skip) = _mm_extract_epi32(y, 3); + *(int32_t*)dst = _mm_extract_epi32(shifted, 0); + *(int32_t*)(dst+dst_skip) = _mm_extract_epi32(shifted, 1); + *(int32_t*)(dst+2*dst_skip) = _mm_extract_epi32(shifted, 2); + *(int32_t*)(dst+3*dst_skip) = _mm_extract_epi32(shifted, 3); #else - __m128i shuffled1 = _mm_shuffle_epi32(y, _MM_SHUFFLE(0, 3, 2, 1)); - __m128i shuffled2 = _mm_shuffle_epi32(y, _MM_SHUFFLE(1, 0, 3, 2)); - __m128i shuffled3 = _mm_shuffle_epi32(y, _MM_SHUFFLE(2, 1, 0, 3)); + __m128i shuffled1 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(0, 3, 2, 1)); + __m128i shuffled2 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(1, 0, 3, 2)); + __m128i shuffled3 = _mm_shuffle_epi32(shifted, _MM_SHUFFLE(2, 1, 0, 3)); - _mm_store_ss((float*)dst, (__m128)y); + _mm_store_ss((float*)dst, (__m128)shifted); _mm_store_ss((float*)(dst+dst_skip), (__m128)shuffled1); _mm_store_ss((float*)(dst+2*dst_skip), (__m128)shuffled2); @@ -362,7 +374,7 @@ static inline void sample_move_d32scal_sS (char *dst, jack_default_audio_sample_ __m128 clipped = _mm_min_ss(int_max, _mm_max_ss(scaled, int_min)); int y = _mm_cvttss_si32(clipped); - *((int *) dst) = y; + *((int *) dst) = y<<8; dst += dst_skip; src++; @@ -374,17 +386,18 @@ static inline void sample_move_d32scal_sS (char *dst, jack_default_audio_sample_ while (unrolled--) { float32x4_t samples = vld1q_f32(src); - int32x4_t converted = float_32_neon(samples, scaling); + int32x4_t converted = float_24_neon(samples); + int32x4_t shifted = vshlq_n_s32(converted, 8); switch(dst_skip) { case 4: - vst1q_s32((int32_t*)dst, converted); + vst1q_s32((int32_t*)dst, shifted); break; default: - vst1q_lane_s32((int32_t*)(dst), converted, 0); - vst1q_lane_s32((int32_t*)(dst+dst_skip), converted, 1); - vst1q_lane_s32((int32_t*)(dst+2*dst_skip), converted, 2); - vst1q_lane_s32((int32_t*)(dst+3*dst_skip), converted, 3); + vst1q_lane_s32((int32_t*)(dst), shifted, 0); + vst1q_lane_s32((int32_t*)(dst+dst_skip), shifted, 1); + vst1q_lane_s32((int32_t*)(dst+2*dst_skip), shifted, 2); + vst1q_lane_s32((int32_t*)(dst+3*dst_skip), shifted, 3); break; } dst += 4*dst_skip; @@ -395,31 +408,17 @@ static inline void sample_move_d32scal_sS (char *dst, jack_default_audio_sample_ #if !defined (__SSE2__) while (nsamples--) { - float_32 (*src, *((int32_t*) dst), scaling); + float_24u32 (*src, *((int32_t*) dst)); dst += dst_skip; src++; } #endif -} - -void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) -{ - sample_move_d32scal_sS (dst, src, nsamples, dst_skip, state, SAMPLE_24BIT_SCALING); -} - -void sample_move_d32_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) -{ - sample_move_d32scal_sS (dst, src, nsamples, dst_skip, state, SAMPLE_32BIT_SCALING); -} - +} -static inline void sample_move_dS_s32s_signext (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip, const bool do_signext) +void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) { - const jack_default_audio_sample_t scaling_divisor = do_signext ? (SAMPLE_24BIT_SCALING << 8) : SAMPLE_32BIT_SCALING; - const jack_default_audio_sample_t scaling = 1.0 / scaling_divisor; - #if defined (__ARM_NEON__) || defined (__ARM_NEON) - float32x4_t factor = vdupq_n_f32(scaling); + float32x4_t factor = vdupq_n_f32(1.0 / SAMPLE_24BIT_SCALING); unsigned long unrolled = nsamples / 4; while (unrolled--) { int32x4_t src128; @@ -439,11 +438,8 @@ static inline void sample_move_dS_s32s_signext (jack_default_audio_sample_t *dst break; } src128 = vreinterpretq_s32_u8(vrev32q_u8(vreinterpretq_u8_s32(src128))); - if (do_signext) { - /* sign extension - left shift will be reverted by scaling */ - src128 = vshlq_n_s32(src128, 8); - } - float32x4_t as_float = vcvtq_f32_s32(src128); + int32x4_t shifted = vshrq_n_s32(src128, 8); + float32x4_t as_float = vcvtq_f32_s32(shifted); float32x4_t divided = vmulq_f32(as_float, factor); vst1q_f32(dst, divided); @@ -455,6 +451,8 @@ static inline void sample_move_dS_s32s_signext (jack_default_audio_sample_t *dst /* ALERT: signed sign-extension portability !!! */ + const jack_default_audio_sample_t scaling = 1.0/SAMPLE_24BIT_SCALING; + while (nsamples--) { int x; #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -474,35 +472,18 @@ static inline void sample_move_dS_s32s_signext (jack_default_audio_sample_t *dst x <<= 8; x |= (unsigned char)(src[0]); #endif - if (do_signext) { - /* sign extension - left shift will be reverted by scaling */ - x <<= 8; - } - *dst = x * scaling; + *dst = (x >> 8) * scaling; dst++; src += src_skip; } } -void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) -{ - sample_move_dS_s32s_signext (dst, src, nsamples, src_skip, true); -} - -void sample_move_dS_s32s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) -{ - sample_move_dS_s32s_signext (dst, src, nsamples, src_skip, false); -} - - -static inline void sample_move_dS_s32_signext (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip, const bool do_signext) +void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) { - const jack_default_audio_sample_t scaling_divisor = do_signext ? (SAMPLE_24BIT_SCALING << 8) : SAMPLE_32BIT_SCALING; - const jack_default_audio_sample_t scaling = 1.0 / scaling_divisor; - #if defined (__SSE2__) && !defined (__sun__) unsigned long unrolled = nsamples / 4; - __m128 factor = _mm_set1_ps(scaling); + static float inv_sample_max_24bit = 1.0 / SAMPLE_24BIT_SCALING; + __m128 factor = _mm_set1_ps(inv_sample_max_24bit); while (unrolled--) { int i1 = *((int *) src); @@ -514,12 +495,10 @@ static inline void sample_move_dS_s32_signext (jack_default_audio_sample_t *dst, int i4 = *((int *) src); src+= src_skip; - __m128i src128 = _mm_set_epi32(i4, i3, i2, i1); - if (do_signext) { - /* sign extension - left shift will be reverted by scaling */ - src128 = _mm_slli_epi32(src128, 8); - } - __m128 as_float = _mm_cvtepi32_ps(src128); + __m128i src = _mm_set_epi32(i4, i3, i2, i1); + __m128i shifted = _mm_srai_epi32(src, 8); + + __m128 as_float = _mm_cvtepi32_ps(shifted); __m128 divided = _mm_mul_ps(as_float, factor); _mm_storeu_ps(dst, divided); @@ -529,7 +508,7 @@ static inline void sample_move_dS_s32_signext (jack_default_audio_sample_t *dst, nsamples = nsamples & 3; #elif defined (__ARM_NEON__) || defined (__ARM_NEON) unsigned long unrolled = nsamples / 4; - float32x4_t factor = vdupq_n_f32(scaling); + float32x4_t factor = vdupq_n_f32(1.0 / SAMPLE_24BIT_SCALING); while (unrolled--) { int32x4_t src128; switch(src_skip) { @@ -546,11 +525,8 @@ static inline void sample_move_dS_s32_signext (jack_default_audio_sample_t *dst, src128 = vld1q_lane_s32((int32_t*)(src+3*src_skip), src128, 3); break; } - if (do_signext) { - /* sign extension - left shift will be reverted by scaling */ - src128 = vshlq_n_s32(src128, 8); - } - float32x4_t as_float = vcvtq_f32_s32(src128); + int32x4_t shifted = vshrq_n_s32(src128, 8); + float32x4_t as_float = vcvtq_f32_s32(shifted); float32x4_t divided = vmulq_f32(as_float, factor); vst1q_f32(dst, divided); @@ -562,29 +538,14 @@ static inline void sample_move_dS_s32_signext (jack_default_audio_sample_t *dst, /* ALERT: signed sign-extension portability !!! */ + const jack_default_audio_sample_t scaling = 1.0/SAMPLE_24BIT_SCALING; while (nsamples--) { - int src32 = *((int *) src); - if (do_signext) { - /* sign extension - left shift will be reverted by scaling */ - src32 <<= 8; - } - *dst = src32 * scaling; + *dst = (*((int *) src) >> 8) * scaling; dst++; src += src_skip; } } -void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) -{ - sample_move_dS_s32_signext (dst, src, nsamples, src_skip, true); -} - -void sample_move_dS_s32 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip) -{ - sample_move_dS_s32_signext (dst, src, nsamples, src_skip, false); -} - - void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state) { #if defined (__ARM_NEON__) || defined (__ARM_NEON) @@ -593,7 +554,7 @@ void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned int i; int32_t z[4]; float32x4_t samples = vld1q_f32(src); - int32x4_t converted = float_32_neon(samples, SAMPLE_24BIT_SCALING); + int32x4_t converted = float_24_neon(samples); converted = vreinterpretq_s32_u8(vrev32q_u8(vreinterpretq_u8_s32(converted))); vst1q_s32(z, converted); @@ -664,7 +625,7 @@ void sample_move_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned l int i; int32_t z[4]; float32x4_t samples = vld1q_f32(src); - int32x4_t converted = float_32_neon(samples, SAMPLE_24BIT_SCALING); + int32x4_t converted = float_24_neon(samples); vst1q_s32(z, converted); for (i = 0; i != 4; ++i) { diff --git a/common/memops.h b/common/memops.h index 93ce457d..c027e4d6 100644 --- a/common/memops.h +++ b/common/memops.h @@ -53,8 +53,6 @@ void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsig void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); /* integer functions */ -void sample_move_d32_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); -void sample_move_d32_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); @@ -81,8 +79,6 @@ void sample_move_dither_tri_d16_sS (char *dst, jack_default_audio_sample_ void sample_move_dither_shaped_d16_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); void sample_move_dither_shaped_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); -void sample_move_dS_s32s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip); -void sample_move_dS_s32 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip); void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip); void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip); void sample_move_dS_s24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip); diff --git a/example-clients/alsa_in.c b/example-clients/alsa_in.c index cd0e2a6c..de694e07 100644 --- a/example-clients/alsa_in.c +++ b/example-clients/alsa_in.c @@ -95,9 +95,9 @@ typedef struct alsa_format { alsa_format_t formats[] = { { SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" }, - { SND_PCM_FORMAT_S32, 4, sample_move_d32_sS, sample_move_dS_s32, "32bit" }, + { SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" }, { SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" }, - { SND_PCM_FORMAT_S24, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "24bit" }, + { SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" }, { SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" } #ifdef __ANDROID__ ,{ SND_PCM_FORMAT_S16_LE, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit little-endian" } diff --git a/example-clients/alsa_out.c b/example-clients/alsa_out.c index 5b1a4f8c..04122603 100644 --- a/example-clients/alsa_out.c +++ b/example-clients/alsa_out.c @@ -96,9 +96,9 @@ typedef struct alsa_format { alsa_format_t formats[] = { { SND_PCM_FORMAT_FLOAT_LE, 4, sample_move_dS_floatLE, sample_move_floatLE_sSs, "float" }, - { SND_PCM_FORMAT_S32, 4, sample_move_d32_sS, sample_move_dS_s32, "32bit" }, + { SND_PCM_FORMAT_S32, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "32bit" }, { SND_PCM_FORMAT_S24_3LE, 3, sample_move_d24_sS, sample_move_dS_s24, "24bit - real" }, - { SND_PCM_FORMAT_S24, 4, sample_move_d32u24_sS, sample_move_dS_s32u24, "24bit" }, + { SND_PCM_FORMAT_S24, 4, sample_move_d24_sS, sample_move_dS_s24, "24bit" }, { SND_PCM_FORMAT_S16, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit" } #ifdef __ANDROID__ ,{ SND_PCM_FORMAT_S16_LE, 2, sample_move_d16_sS, sample_move_dS_s16, "16bit little-endian" } diff --git a/linux/alsa/alsa_driver.c b/linux/alsa/alsa_driver.c index 8e79d52b..39be0624 100644 --- a/linux/alsa/alsa_driver.c +++ b/linux/alsa/alsa_driver.c @@ -312,19 +312,9 @@ alsa_driver_setup_io_function_pointers (alsa_driver_t *driver) break; case 4: /* NO DITHER */ - switch (driver->playback_sample_format) { - case SND_PCM_FORMAT_S24_LE: - case SND_PCM_FORMAT_S24_BE: - driver->write_via_copy = driver->quirk_bswap? - sample_move_d32u24_sSs: - sample_move_d32u24_sS; - break; - default: - driver->write_via_copy = driver->quirk_bswap? - sample_move_d32_sSs: - sample_move_d32_sS; - break; - } + driver->write_via_copy = driver->quirk_bswap? + sample_move_d32u24_sSs: + sample_move_d32u24_sS; break; default: @@ -351,20 +341,9 @@ alsa_driver_setup_io_function_pointers (alsa_driver_t *driver) sample_move_dS_s24; break; case 4: - switch (driver->playback_sample_format) { - case SND_PCM_FORMAT_S24_LE: - case SND_PCM_FORMAT_S24_BE: - driver->read_via_copy = driver->quirk_bswap? - sample_move_dS_s32u24s: - sample_move_dS_s32u24; - break; - default: - driver->read_via_copy = driver->quirk_bswap? - sample_move_dS_s32s: - sample_move_dS_s32; - break; - } - + driver->read_via_copy = driver->quirk_bswap? + sample_move_dS_s32u24s: + sample_move_dS_s32u24; break; } } diff --git a/solaris/oss/JackBoomerDriver.cpp b/solaris/oss/JackBoomerDriver.cpp index f207addb..5f07bc57 100644 --- a/solaris/oss/JackBoomerDriver.cpp +++ b/solaris/oss/JackBoomerDriver.cpp @@ -87,7 +87,7 @@ static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframe case 32: { signed int *s32src = (signed int*)src; s32src += channel; - sample_move_dS_s32(dst, (char*)s32src, nframes, byte_skip); + sample_move_dS_s32u24(dst, (char*)s32src, nframes, byte_skip); break; } } @@ -112,7 +112,7 @@ static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nfram case 32: { signed int *s32dst = (signed int*)dst; s32dst += channel; - sample_move_d32_sS((char*)s32dst, src, nframes, byte_skip, NULL); + sample_move_d32u24_sS((char*)s32dst, src, nframes, byte_skip, NULL); break; } } diff --git a/solaris/oss/JackOSSAdapter.cpp b/solaris/oss/JackOSSAdapter.cpp index 23615992..8418068d 100644 --- a/solaris/oss/JackOSSAdapter.cpp +++ b/solaris/oss/JackOSSAdapter.cpp @@ -52,7 +52,7 @@ static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframe case 32: { signed int *s32src = (signed int*)src; s32src += channel; - sample_move_dS_s32(dst, (char*)s32src, nframes, chcount<<2); + sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2); break; } } @@ -77,7 +77,7 @@ static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nfram case 32: { signed int *s32dst = (signed int*)dst; s32dst += channel; - sample_move_d32_sS((char*)s32dst, src, nframes, chcount<<2, NULL); + sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); break; } } diff --git a/solaris/oss/JackOSSDriver.cpp b/solaris/oss/JackOSSDriver.cpp index f1affaf0..77ca6e00 100644 --- a/solaris/oss/JackOSSDriver.cpp +++ b/solaris/oss/JackOSSDriver.cpp @@ -86,7 +86,7 @@ static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframe case 32: { signed int *s32src = (signed int*)src; s32src += channel; - sample_move_dS_s32(dst, (char*)s32src, nframes, chcount<<2); + sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2); break; } } @@ -111,7 +111,7 @@ static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nfram case 32: { signed int *s32dst = (signed int*)dst; s32dst += channel; - sample_move_d32_sS((char*)s32dst, src, nframes, chcount<<2, NULL); + sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); break; } } |