2023-02-08 18:12:00 +01:00
|
|
|
/* Spa */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
2019-03-27 17:58:48 +01:00
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#include <spa/utils/defs.h>
|
2024-06-25 16:32:13 -07:00
|
|
|
#include <spa/utils/endian.h>
|
2022-06-28 16:55:50 +02:00
|
|
|
#include <spa/utils/string.h>
|
|
|
|
|
|
2022-07-13 20:56:13 +02:00
|
|
|
#define f32_round(a) lrintf(a)
|
2022-07-13 18:10:25 +02:00
|
|
|
|
|
|
|
|
#define ITOF(type,v,scale,offs) \
|
|
|
|
|
(((type)(v)) * (1.0f / (scale)) - (offs))
|
2022-07-15 12:36:15 +02:00
|
|
|
#define FTOI(type,v,scale,offs,noise,min,max) \
|
2022-07-19 17:59:14 +02:00
|
|
|
(type)f32_round(SPA_CLAMPF((v) * (scale) + (offs) + (noise), min, max))
|
2022-07-13 18:10:25 +02:00
|
|
|
|
2024-11-19 19:57:37 +01:00
|
|
|
#define FMT_OPS_MAX_ALIGN 32u
|
2019-03-27 17:58:48 +01:00
|
|
|
|
2022-06-29 14:10:15 +02:00
|
|
|
#define U8_MIN 0u
|
|
|
|
|
#define U8_MAX 255u
|
2022-07-05 15:50:05 +02:00
|
|
|
#define U8_SCALE 128.f
|
2022-06-29 14:10:15 +02:00
|
|
|
#define U8_OFFS 128.f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define U8_TO_F32(v) ITOF(uint8_t, v, U8_SCALE, 1.0f)
|
|
|
|
|
#define F32_TO_U8_D(v,d) FTOI(uint8_t, v, U8_SCALE, U8_OFFS, d, U8_MIN, U8_MAX)
|
|
|
|
|
#define F32_TO_U8(v) F32_TO_U8_D(v, 0.0f)
|
2022-06-29 14:10:15 +02:00
|
|
|
|
2022-07-05 15:50:05 +02:00
|
|
|
#define S8_MIN -128
|
2022-06-29 14:10:15 +02:00
|
|
|
#define S8_MAX 127
|
2022-07-05 15:50:05 +02:00
|
|
|
#define S8_SCALE 128.0f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define S8_TO_F32(v) ITOF(int8_t, v, S8_SCALE, 0.0f)
|
|
|
|
|
#define F32_TO_S8_D(v,d) FTOI(int8_t, v, S8_SCALE, 0.0f, d, S8_MIN, S8_MAX)
|
|
|
|
|
#define F32_TO_S8(v) F32_TO_S8_D(v, 0.0f);
|
2022-06-29 14:10:15 +02:00
|
|
|
|
|
|
|
|
#define U16_MIN 0u
|
|
|
|
|
#define U16_MAX 65535u
|
2022-07-05 15:50:05 +02:00
|
|
|
#define U16_SCALE 32768.f
|
2022-06-29 14:10:15 +02:00
|
|
|
#define U16_OFFS 32768.f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define U16_TO_F32(v) ITOF(uint16_t, v, U16_SCALE, 1.0f)
|
|
|
|
|
#define U16S_TO_F32(v) U16_TO_F32(bswap_16(v))
|
|
|
|
|
#define F32_TO_U16_D(v,d) FTOI(uint16_t, v, U16_SCALE, U16_OFFS, d, U16_MIN, U16_MAX)
|
|
|
|
|
#define F32_TO_U16(v) F32_TO_U16_D(v, 0.0f);
|
2022-06-29 14:10:15 +02:00
|
|
|
#define F32_TO_U16S_D(v,d) bswap_16(F32_TO_U16_D(v,d))
|
2022-07-13 18:10:25 +02:00
|
|
|
#define F32_TO_U16S(v) bswap_16(F32_TO_U16(v))
|
2022-06-29 14:10:15 +02:00
|
|
|
|
2022-07-05 12:20:02 +02:00
|
|
|
#define S16_MIN -32768
|
2022-06-29 14:10:15 +02:00
|
|
|
#define S16_MAX 32767
|
2022-07-05 12:20:02 +02:00
|
|
|
#define S16_SCALE 32768.0f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define S16_TO_F32(v) ITOF(int16_t, v, S16_SCALE, 0.0f)
|
|
|
|
|
#define S16S_TO_F32(v) S16_TO_F32(bswap_16(v))
|
|
|
|
|
#define F32_TO_S16_D(v,d) FTOI(int16_t, v, S16_SCALE, 0.0f, d, S16_MIN, S16_MAX)
|
|
|
|
|
#define F32_TO_S16(v) F32_TO_S16_D(v, 0.0f)
|
2022-06-29 14:10:15 +02:00
|
|
|
#define F32_TO_S16S_D(v,d) bswap_16(F32_TO_S16_D(v,d))
|
2022-07-13 18:10:25 +02:00
|
|
|
#define F32_TO_S16S(v) bswap_16(F32_TO_S16(v))
|
2022-06-29 14:10:15 +02:00
|
|
|
|
|
|
|
|
#define U24_MIN 0u
|
|
|
|
|
#define U24_MAX 16777215u
|
2022-07-05 15:50:05 +02:00
|
|
|
#define U24_SCALE 8388608.f
|
2022-06-29 14:10:15 +02:00
|
|
|
#define U24_OFFS 8388608.f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define U24_TO_F32(v) ITOF(uint32_t, u24_to_u32(v), U24_SCALE, 1.0f)
|
|
|
|
|
#define F32_TO_U24_D(v,d) u32_to_u24(FTOI(uint32_t, v, U24_SCALE, U24_OFFS, d, U24_MIN, U24_MAX))
|
|
|
|
|
#define F32_TO_U24(v) F32_TO_U24_D(v, 0.0f)
|
2022-06-29 14:10:15 +02:00
|
|
|
|
2022-07-05 12:20:02 +02:00
|
|
|
#define S24_MIN -8388608
|
2022-06-29 14:10:15 +02:00
|
|
|
#define S24_MAX 8388607
|
2022-07-05 12:20:02 +02:00
|
|
|
#define S24_SCALE 8388608.0f
|
2022-07-13 18:10:25 +02:00
|
|
|
#define S24_TO_F32(v) ITOF(int32_t, s24_to_s32(v), S24_SCALE, 0.0f)
|
|
|
|
|
#define S24S_TO_F32(v) S24_TO_F32(bswap_s24(v))
|
|
|
|
|
#define F32_TO_S24_D(v,d) s32_to_s24(FTOI(int32_t, v, S24_SCALE, 0.0f, d, S24_MIN, S24_MAX))
|
|
|
|
|
#define F32_TO_S24(v) F32_TO_S24_D(v, 0.0f)
|
2022-07-01 12:24:35 +02:00
|
|
|
#define F32_TO_S24S(v) bswap_s24(F32_TO_S24(v))
|
2022-06-29 14:10:15 +02:00
|
|
|
|
2023-01-24 21:29:18 +01:00
|
|
|
#define U24_32_TO_U32(v) (((uint32_t)(v)) << 8)
|
|
|
|
|
|
|
|
|
|
#define U24_32_TO_F32(v) U32_TO_F32(U24_32_TO_U32(v))
|
2022-07-13 18:10:25 +02:00
|
|
|
#define U24_32S_TO_F32(v) U24_32_TO_F32(bswap_32(v))
|
|
|
|
|
#define F32_TO_U24_32_D(v,d) FTOI(uint32_t, v, U24_SCALE, U24_OFFS, d, U24_MIN, U24_MAX)
|
|
|
|
|
#define F32_TO_U24_32(v) F32_TO_U24_32_D(v, 0.0f)
|
2022-07-07 20:11:08 +02:00
|
|
|
#define F32_TO_U24_32S(v) bswap_32(F32_TO_U24_32(v))
|
|
|
|
|
#define F32_TO_U24_32S_D(v,d) bswap_32(F32_TO_U24_32_D(v,d))
|
|
|
|
|
|
2023-01-24 21:29:18 +01:00
|
|
|
#define U32_TO_U24_32(v) (((uint32_t)(v)) >> 8)
|
|
|
|
|
|
2024-06-13 16:18:33 +03:00
|
|
|
#define S25_MIN -16777216
|
|
|
|
|
#define S25_MAX 16777215
|
|
|
|
|
#define S25_SCALE 16777216.0f
|
|
|
|
|
#define S25_32_TO_F32(v) ITOF(int32_t, v, S25_SCALE, 0.0f)
|
|
|
|
|
#define S25_32S_TO_F32(v) S25_32_TO_F32(bswap_32(v))
|
|
|
|
|
#define F32_TO_S25_32_D(v,d) FTOI(int32_t, v, S25_SCALE, 0.0f, d, S25_MIN, S25_MAX)
|
|
|
|
|
#define F32_TO_S25_32(v) F32_TO_S25_32_D(v, 0.0f)
|
|
|
|
|
#define F32_TO_S25_32S(v) bswap_32(F32_TO_S25_32(v))
|
|
|
|
|
#define F32_TO_S25_32S_D(v,d) bswap_32(F32_TO_S25_32_D(v,d))
|
|
|
|
|
#define S25_32_TO_S32(v) ((int32_t)(((uint32_t)(v)) << 7))
|
|
|
|
|
#define S32_TO_S25_32(v) (((int32_t)(v)) >> 7)
|
|
|
|
|
|
2022-06-29 14:10:15 +02:00
|
|
|
#define U32_MIN 0u
|
2022-07-07 18:38:32 +02:00
|
|
|
#define U32_MAX 4294967295u
|
2022-07-05 15:50:05 +02:00
|
|
|
#define U32_SCALE 2147483648.f
|
2022-07-05 12:20:02 +02:00
|
|
|
#define U32_OFFS 2147483648.f
|
2023-01-24 21:29:18 +01:00
|
|
|
#define U32_TO_F32(v) ITOF(uint32_t, U32_TO_U24_32(v), U24_SCALE, 1.0f)
|
|
|
|
|
#define F32_TO_U32(v) U24_32_TO_U32(F32_TO_U24_32(v))
|
|
|
|
|
#define F32_TO_U32_D(v,d) U24_32_TO_U32(F32_TO_U24_32_D(v,d))
|
2022-07-07 20:11:08 +02:00
|
|
|
|
2023-01-24 21:29:18 +01:00
|
|
|
#define S24_32_TO_S32(v) ((int32_t)(((uint32_t)(v)) << 8))
|
|
|
|
|
|
|
|
|
|
#define S24_32_TO_F32(v) S32_TO_F32(S24_32_TO_S32(v))
|
2022-07-13 18:10:25 +02:00
|
|
|
#define S24_32S_TO_F32(v) S24_32_TO_F32(bswap_32(v))
|
|
|
|
|
#define F32_TO_S24_32_D(v,d) FTOI(int32_t, v, S24_SCALE, 0.0f, d, S24_MIN, S24_MAX)
|
|
|
|
|
#define F32_TO_S24_32(v) F32_TO_S24_32_D(v, 0.0f)
|
2022-07-07 20:11:08 +02:00
|
|
|
#define F32_TO_S24_32S(v) bswap_32(F32_TO_S24_32(v))
|
|
|
|
|
#define F32_TO_S24_32S_D(v,d) bswap_32(F32_TO_S24_32_D(v,d))
|
2022-06-29 14:10:15 +02:00
|
|
|
|
2023-01-24 21:29:18 +01:00
|
|
|
#define S32_TO_S24_32(v) (((int32_t)(v)) >> 8)
|
|
|
|
|
|
audioconvert: avoid even more precision loss in S32 to F32 conversion
There's really no point in doing that s25_32 intermediate step,
to be honest i don't have a clue why the original implementation
did that \_(ツ)_/¯.
Both `S25_SCALE` and `S32_SCALE` are powers of two,
and thus are both exactly representable as floats,
and reprocial of power-of-two is also exactly representable,
so it's not like that rescaling results in precision loss.
This additionally avoids right-shift, and thus is even faster.
As `test_lossless_s32_lossless_subset` shows,
if the integer is in the form of s25+shift,
the maximal absolute error became even lower,
but not zero, because F32->S32 still goes through S25 intermediate.
I think we could theoretically do better,
but then the clamping becomes pretty finicky,
so i don't feel like touching that here.
2024-06-14 06:05:18 +03:00
|
|
|
#define S32_MIN -2147483648
|
|
|
|
|
#define S32_MAX 2147483647
|
audioconvert: avoid even more precision loss in F32 to S32 conversion
This is somewhat similar to the S32->F32 conversion improvements,
but here things a bit more tricky...
The main consideration is that the limits to which we clamp
must be valid 32-bit signed integers, but not all such integers
are exactly losslessly representable in `float32_t`.
For example it we'd clamp to `2147483647`,
that is actually a `2147483648.0f`,
and `2147483648` is not a valid 32-bit signed integer,
so the post-clamp conversion would basically be UB.
We don't have this problem for negative bound, though.
But as we know, any 25-bit signed integer is losslessly
round-trippable through float32_t, and since multiplying by 2
only changes the float's exponent, we can clamp to `2147483520`!
The algorithm of selection of the pre-clamping scale is unaffected.
This additionally avoids right-shift, and thus is even faster.
As `test_lossless_s32_lossless_subset` shows,
if the integer is in the form of s25+shift,
the maximal absolute error is finally zero.
Without going through `float`->`double`->`int`,
i'm not sure if the `float`->`int` conversion
can be improved further.
2024-06-25 19:20:42 +03:00
|
|
|
#define S32_SCALE_I2F 2147483648.0f
|
|
|
|
|
#define S32_TO_F32(v) ITOF(int32_t, v, S32_SCALE_I2F, 0.0f)
|
2022-07-07 20:11:08 +02:00
|
|
|
#define S32S_TO_F32(v) S32_TO_F32(bswap_32(v))
|
audioconvert: avoid even more precision loss in F32 to S32 conversion
This is somewhat similar to the S32->F32 conversion improvements,
but here things a bit more tricky...
The main consideration is that the limits to which we clamp
must be valid 32-bit signed integers, but not all such integers
are exactly losslessly representable in `float32_t`.
For example it we'd clamp to `2147483647`,
that is actually a `2147483648.0f`,
and `2147483648` is not a valid 32-bit signed integer,
so the post-clamp conversion would basically be UB.
We don't have this problem for negative bound, though.
But as we know, any 25-bit signed integer is losslessly
round-trippable through float32_t, and since multiplying by 2
only changes the float's exponent, we can clamp to `2147483520`!
The algorithm of selection of the pre-clamping scale is unaffected.
This additionally avoids right-shift, and thus is even faster.
As `test_lossless_s32_lossless_subset` shows,
if the integer is in the form of s25+shift,
the maximal absolute error is finally zero.
Without going through `float`->`double`->`int`,
i'm not sure if the `float`->`int` conversion
can be improved further.
2024-06-25 19:20:42 +03:00
|
|
|
|
|
|
|
|
#define S32_MIN_F2I ((int32_t)(((uint32_t)(S25_MIN)) << 7))
|
|
|
|
|
#define S32_MAX_F2I ((S25_MAX) << 7)
|
|
|
|
|
#define S32_SCALE_F2I (-((float)(S32_MIN_F2I)))
|
|
|
|
|
#define F32_TO_S32_D(v,d) FTOI(int32_t, v, S32_SCALE_F2I, 0.0f, d, S32_MIN_F2I, S32_MAX_F2I)
|
2024-06-14 04:48:03 +03:00
|
|
|
#define F32_TO_S32(v) F32_TO_S32_D(v, 0.0f)
|
2022-06-29 14:10:15 +02:00
|
|
|
#define F32_TO_S32S(v) bswap_32(F32_TO_S32(v))
|
|
|
|
|
#define F32_TO_S32S_D(v,d) bswap_32(F32_TO_S32_D(v,d))
|
2019-03-27 17:58:48 +01:00
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
typedef struct {
|
2021-09-08 09:07:49 -04:00
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
2022-07-01 12:24:35 +02:00
|
|
|
uint8_t v3;
|
|
|
|
|
uint8_t v2;
|
|
|
|
|
uint8_t v1;
|
2021-09-08 09:07:49 -04:00
|
|
|
#else
|
2022-07-01 12:24:35 +02:00
|
|
|
uint8_t v1;
|
|
|
|
|
uint8_t v2;
|
|
|
|
|
uint8_t v3;
|
2021-09-08 09:07:49 -04:00
|
|
|
#endif
|
2022-07-01 12:24:35 +02:00
|
|
|
} __attribute__ ((packed)) uint24_t;
|
2021-09-08 09:07:49 -04:00
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
typedef struct {
|
2019-03-27 17:58:48 +01:00
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
2022-07-01 12:24:35 +02:00
|
|
|
uint8_t v3;
|
|
|
|
|
uint8_t v2;
|
|
|
|
|
int8_t v1;
|
2019-03-27 17:58:48 +01:00
|
|
|
#else
|
2022-07-01 12:24:35 +02:00
|
|
|
int8_t v1;
|
|
|
|
|
uint8_t v2;
|
|
|
|
|
uint8_t v3;
|
2019-03-27 17:58:48 +01:00
|
|
|
#endif
|
2022-07-01 12:24:35 +02:00
|
|
|
} __attribute__ ((packed)) int24_t;
|
|
|
|
|
|
|
|
|
|
static inline uint32_t u24_to_u32(uint24_t src)
|
|
|
|
|
{
|
|
|
|
|
return ((uint32_t)src.v1 << 16) | ((uint32_t)src.v2 << 8) | (uint32_t)src.v3;
|
2019-03-27 17:58:48 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-05 12:18:57 +02:00
|
|
|
#define U32_TO_U24(s) (uint24_t) { .v1 = (uint8_t)(((uint32_t)s) >> 16), \
|
|
|
|
|
.v2 = (uint8_t)(((uint32_t)s) >> 8), .v3 = (uint8_t)((uint32_t)s) }
|
|
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
static inline uint24_t u32_to_u24(uint32_t src)
|
2020-01-27 15:46:25 +01:00
|
|
|
{
|
2022-07-05 12:18:57 +02:00
|
|
|
return U32_TO_U24(src);
|
2020-01-27 15:46:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
static inline int32_t s24_to_s32(int24_t src)
|
2021-09-08 09:07:49 -04:00
|
|
|
{
|
2023-10-15 21:00:01 +02:00
|
|
|
return ((uint32_t)((int32_t)src.v1 & 0xFFFF) << 16) | ((uint32_t)src.v2 << 8) | (uint32_t)src.v3;
|
2021-09-08 09:07:49 -04:00
|
|
|
}
|
|
|
|
|
|
2022-07-05 12:18:57 +02:00
|
|
|
#define S32_TO_S24(s) (int24_t) { .v1 = (int8_t)(((int32_t)s) >> 16), \
|
|
|
|
|
.v2 = (uint8_t)(((uint32_t)s) >> 8), .v3 = (uint8_t)((uint32_t)s) }
|
|
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
static inline int24_t s32_to_s24(int32_t src)
|
2019-03-27 17:58:48 +01:00
|
|
|
{
|
2022-07-05 12:18:57 +02:00
|
|
|
return S32_TO_S24(src);
|
2019-03-27 17:58:48 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-01 12:24:35 +02:00
|
|
|
static inline uint24_t bswap_u24(uint24_t src)
|
2020-01-27 15:46:25 +01:00
|
|
|
{
|
2022-07-05 14:56:54 +02:00
|
|
|
return (uint24_t) { .v1 = src.v3, .v2 = src.v2, .v3 = src.v1 };
|
2022-07-01 12:24:35 +02:00
|
|
|
}
|
|
|
|
|
static inline int24_t bswap_s24(int24_t src)
|
|
|
|
|
{
|
2022-07-05 14:56:54 +02:00
|
|
|
return (int24_t) { .v1 = src.v3, .v2 = src.v2, .v3 = src.v1 };
|
2020-01-27 15:46:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-11 10:58:51 +02:00
|
|
|
#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)
|
|
|
|
|
|
2022-06-29 17:31:32 +02:00
|
|
|
#define NS_MAX 8
|
|
|
|
|
#define NS_MASK (NS_MAX-1)
|
|
|
|
|
|
|
|
|
|
struct shaper {
|
2022-07-15 12:36:15 +02:00
|
|
|
float e[NS_MAX * 2];
|
2022-06-29 17:31:32 +02:00
|
|
|
uint32_t idx;
|
|
|
|
|
float r;
|
|
|
|
|
};
|
2019-03-29 17:39:59 +01:00
|
|
|
|
|
|
|
|
struct convert {
|
2022-07-15 12:36:15 +02:00
|
|
|
uint32_t noise_bits;
|
2022-06-28 16:55:50 +02:00
|
|
|
#define DITHER_METHOD_NONE 0
|
|
|
|
|
#define DITHER_METHOD_RECTANGULAR 1
|
|
|
|
|
#define DITHER_METHOD_TRIANGULAR 2
|
2022-07-15 12:36:15 +02:00
|
|
|
#define DITHER_METHOD_TRIANGULAR_HF 3
|
2022-07-18 10:21:56 +02:00
|
|
|
#define DITHER_METHOD_WANNAMAKER_3 4
|
2022-07-15 12:36:15 +02:00
|
|
|
#define DITHER_METHOD_LIPSHITZ 5
|
2022-06-28 16:55:50 +02:00
|
|
|
uint32_t method;
|
|
|
|
|
|
2019-03-29 17:39:59 +01:00
|
|
|
uint32_t src_fmt;
|
|
|
|
|
uint32_t dst_fmt;
|
|
|
|
|
uint32_t n_channels;
|
2022-06-29 14:10:15 +02:00
|
|
|
uint32_t rate;
|
2019-03-29 17:39:59 +01:00
|
|
|
uint32_t cpu_flags;
|
2022-06-28 16:55:50 +02:00
|
|
|
const char *func_name;
|
2019-03-29 17:39:59 +01:00
|
|
|
|
2019-04-10 17:52:42 +02:00
|
|
|
unsigned int is_passthrough:1;
|
2022-06-28 16:55:50 +02:00
|
|
|
|
2022-06-29 14:10:15 +02:00
|
|
|
float scale;
|
2022-09-29 20:34:15 +02:00
|
|
|
uint32_t *random;
|
|
|
|
|
int32_t *prev;
|
2022-07-15 12:36:15 +02:00
|
|
|
#define NOISE_METHOD_NONE 0
|
|
|
|
|
#define NOISE_METHOD_RECTANGULAR 1
|
|
|
|
|
#define NOISE_METHOD_TRIANGULAR 2
|
|
|
|
|
#define NOISE_METHOD_TRIANGULAR_HF 3
|
2022-07-18 11:39:24 +02:00
|
|
|
#define NOISE_METHOD_PATTERN 4
|
2022-07-15 12:36:15 +02:00
|
|
|
uint32_t noise_method;
|
|
|
|
|
float *noise;
|
|
|
|
|
uint32_t noise_size;
|
|
|
|
|
const float *ns;
|
|
|
|
|
uint32_t n_ns;
|
2025-10-24 12:46:38 +02:00
|
|
|
struct shaper *shaper;
|
2019-03-29 17:39:59 +01:00
|
|
|
|
2022-09-29 20:34:15 +02:00
|
|
|
void (*update_noise) (struct convert *conv, float *noise, uint32_t n_samples);
|
2019-03-29 17:39:59 +01:00
|
|
|
void (*process) (struct convert *conv, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
|
|
|
|
uint32_t n_samples);
|
2025-07-01 18:06:39 +02:00
|
|
|
void (*clear) (struct convert *conv, void * SPA_RESTRICT dst[], uint32_t n_samples);
|
2019-03-29 17:39:59 +01:00
|
|
|
void (*free) (struct convert *conv);
|
2022-09-29 20:34:15 +02:00
|
|
|
|
|
|
|
|
void *data;
|
2019-03-29 17:39:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int convert_init(struct convert *conv);
|
|
|
|
|
|
2022-06-28 16:55:50 +02:00
|
|
|
static const struct dither_method_info {
|
2022-07-15 12:36:15 +02:00
|
|
|
uint32_t method;
|
2022-06-28 16:55:50 +02:00
|
|
|
const char *label;
|
|
|
|
|
const char *description;
|
|
|
|
|
} dither_method_info[] = {
|
2022-07-15 12:36:15 +02:00
|
|
|
[DITHER_METHOD_NONE] = { DITHER_METHOD_NONE,
|
|
|
|
|
"none", "Disabled", },
|
|
|
|
|
[DITHER_METHOD_RECTANGULAR] = { DITHER_METHOD_RECTANGULAR,
|
|
|
|
|
"rectangular", "Rectangular dithering", },
|
|
|
|
|
[DITHER_METHOD_TRIANGULAR] = { DITHER_METHOD_TRIANGULAR,
|
|
|
|
|
"triangular", "Triangular dithering", },
|
|
|
|
|
[DITHER_METHOD_TRIANGULAR_HF] = { DITHER_METHOD_TRIANGULAR_HF,
|
|
|
|
|
"triangular-hf", "Sloped Triangular dithering", },
|
2022-07-18 10:21:56 +02:00
|
|
|
[DITHER_METHOD_WANNAMAKER_3] = { DITHER_METHOD_WANNAMAKER_3,
|
|
|
|
|
"wannamaker3", "Wannamaker 3 dithering", },
|
2022-07-15 12:36:15 +02:00
|
|
|
[DITHER_METHOD_LIPSHITZ] = { DITHER_METHOD_LIPSHITZ,
|
|
|
|
|
"shaped5", "Lipshitz 5 dithering", },
|
2022-06-28 16:55:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static inline uint32_t dither_method_from_label(const char *label)
|
|
|
|
|
{
|
2022-09-30 16:21:28 +02:00
|
|
|
SPA_FOR_EACH_ELEMENT_VAR(dither_method_info, i) {
|
|
|
|
|
if (spa_streq(i->label, label))
|
|
|
|
|
return i->method;
|
2022-06-28 16:55:50 +02:00
|
|
|
}
|
|
|
|
|
return DITHER_METHOD_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 20:34:15 +02:00
|
|
|
#define convert_update_noise(conv,...) (conv)->update_noise(conv, __VA_ARGS__)
|
2019-03-29 17:39:59 +01:00
|
|
|
#define convert_process(conv,...) (conv)->process(conv, __VA_ARGS__)
|
2025-07-01 18:06:39 +02:00
|
|
|
#define convert_clear(conv,...) (conv)->clear(conv, __VA_ARGS__)
|
2019-03-29 17:39:59 +01:00
|
|
|
#define convert_free(conv) (conv)->free(conv)
|
2019-03-27 17:58:48 +01:00
|
|
|
|
2022-09-29 20:34:15 +02:00
|
|
|
#define DEFINE_NOISE_FUNCTION(name,arch) \
|
|
|
|
|
void conv_noise_##name##_##arch(struct convert *conv, float *noise, \
|
|
|
|
|
uint32_t n_samples)
|
|
|
|
|
|
|
|
|
|
DEFINE_NOISE_FUNCTION(none, c);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(rect, c);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(tri, c);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(tri_hf, c);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(pattern, c);
|
|
|
|
|
#if defined(HAVE_SSE2)
|
|
|
|
|
DEFINE_NOISE_FUNCTION(rect, sse2);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(tri, sse2);
|
|
|
|
|
DEFINE_NOISE_FUNCTION(tri_hf, sse2);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#undef DEFINE_NOISE_FUNCTION
|
|
|
|
|
|
|
|
|
|
#define DEFINE_FUNCTION(name,arch) \
|
2019-03-29 17:39:59 +01:00
|
|
|
void conv_##name##_##arch(struct convert *conv, void * SPA_RESTRICT dst[], \
|
2022-09-29 20:34:15 +02:00
|
|
|
const void * SPA_RESTRICT src[], uint32_t n_samples)
|
2019-03-28 21:07:53 +01:00
|
|
|
|
|
|
|
|
DEFINE_FUNCTION(copy8d, c);
|
|
|
|
|
DEFINE_FUNCTION(copy8, c);
|
|
|
|
|
DEFINE_FUNCTION(copy16d, c);
|
|
|
|
|
DEFINE_FUNCTION(copy16, c);
|
|
|
|
|
DEFINE_FUNCTION(copy24d, c);
|
|
|
|
|
DEFINE_FUNCTION(copy24, c);
|
|
|
|
|
DEFINE_FUNCTION(copy32d, c);
|
|
|
|
|
DEFINE_FUNCTION(copy32, c);
|
2022-01-10 13:04:31 +01:00
|
|
|
DEFINE_FUNCTION(copy64d, c);
|
|
|
|
|
DEFINE_FUNCTION(copy64, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(u8d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(u8_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(u8_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(u8d_to_f32, c);
|
2021-05-05 08:56:59 +03:00
|
|
|
DEFINE_FUNCTION(s8d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s8_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(s8_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s8d_to_f32, c);
|
2021-08-17 17:32:25 +02:00
|
|
|
DEFINE_FUNCTION(ulaw_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(alaw_to_f32d, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(u16_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(u16_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s16d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s16_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(s16_to_f32d, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(s16s_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s16d_to_f32, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(u32_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(u32_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s32d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s32_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(s32_to_f32d, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(s32s_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s32d_to_f32, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(u24_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(u24_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s24_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(s24_to_f32d, c);
|
2020-01-27 15:46:25 +01:00
|
|
|
DEFINE_FUNCTION(s24s_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24d_to_f32, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(u24_32_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(u24_32_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24_32d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(s24_32_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(s24_32_to_f32d, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(s24_32s_to_f32d, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24_32d_to_f32, c);
|
2022-01-10 13:04:31 +01:00
|
|
|
DEFINE_FUNCTION(f64d_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(f64_to_f32, c);
|
|
|
|
|
DEFINE_FUNCTION(f64_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(f64s_to_f32d, c);
|
|
|
|
|
DEFINE_FUNCTION(f64d_to_f32, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_u8d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_u8d_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_u8d_shaped, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32_to_u8, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_u8d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_u8, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_u8_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_u8_shaped, c);
|
2021-05-05 08:56:59 +03:00
|
|
|
DEFINE_FUNCTION(f32d_to_s8d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s8d_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s8d_shaped, c);
|
2021-05-05 08:56:59 +03:00
|
|
|
DEFINE_FUNCTION(f32_to_s8, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_s8d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s8, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s8_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s8_shaped, c);
|
2021-08-17 17:32:25 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_alaw, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_ulaw, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(f32_to_u16, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_u16, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d_shaped, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32_to_s16, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_s16d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s16, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_shaped, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16s, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16s_noise, c);
|
2022-06-29 17:31:32 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16s_shaped, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(f32_to_u32, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_u32, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32d_noise, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32_to_s32, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_s32d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s32, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32_noise, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32s, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32s_noise, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(f32_to_u24, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_u24, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24d_noise, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32_to_s24, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_s24d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s24, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_noise, c);
|
2021-01-14 17:58:54 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24s, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24s_noise, c);
|
2021-09-08 09:07:49 -04:00
|
|
|
DEFINE_FUNCTION(f32_to_u24_32, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_u24_32, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32d, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32d_noise, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32_to_s24_32, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_s24_32d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32_noise, c);
|
2021-08-17 14:45:00 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32s, c);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s24_32s_noise, c);
|
2022-01-10 13:04:31 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_f64d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_f64, c);
|
|
|
|
|
DEFINE_FUNCTION(f32_to_f64d, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_f64, c);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_f64s, c);
|
2022-06-30 18:24:05 +02:00
|
|
|
DEFINE_FUNCTION(8_to_8d, c);
|
|
|
|
|
DEFINE_FUNCTION(16_to_16d, c);
|
|
|
|
|
DEFINE_FUNCTION(24_to_24d, c);
|
|
|
|
|
DEFINE_FUNCTION(32_to_32d, c);
|
2022-07-11 10:58:51 +02:00
|
|
|
DEFINE_FUNCTION(32s_to_32d, c);
|
2022-06-30 18:24:05 +02:00
|
|
|
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);
|
2022-07-11 10:58:51 +02:00
|
|
|
DEFINE_FUNCTION(32d_to_32s, c);
|
2022-06-30 18:24:05 +02:00
|
|
|
DEFINE_FUNCTION(64d_to_64, c);
|
|
|
|
|
DEFINE_FUNCTION(64sd_to_64s, c);
|
2019-03-28 21:07:53 +01:00
|
|
|
|
2020-03-30 10:59:21 -04:00
|
|
|
#if defined(HAVE_NEON)
|
2021-10-28 11:30:04 +02:00
|
|
|
DEFINE_FUNCTION(s16_to_f32d_2, neon);
|
2020-03-30 10:59:21 -04:00
|
|
|
DEFINE_FUNCTION(s16_to_f32d, neon);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s16, neon);
|
|
|
|
|
#endif
|
2024-09-17 08:58:14 +08:00
|
|
|
#if defined(HAVE_RVV)
|
2024-09-25 13:11:08 +08:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32, rvv);
|
2024-09-17 08:58:14 +08:00
|
|
|
DEFINE_FUNCTION(f32_to_s16, rvv);
|
2024-09-23 10:22:44 +08:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d, rvv);
|
2024-09-23 10:53:01 +08:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16, rvv);
|
2024-09-23 21:03:28 +08:00
|
|
|
DEFINE_FUNCTION(s16_to_f32d, rvv);
|
2024-09-29 11:17:18 +08:00
|
|
|
DEFINE_FUNCTION(s32_to_f32d, rvv);
|
2024-09-17 08:58:14 +08:00
|
|
|
#endif
|
2019-03-27 17:58:48 +01:00
|
|
|
#if defined(HAVE_SSE2)
|
2019-03-29 17:39:59 +01:00
|
|
|
DEFINE_FUNCTION(s16_to_f32d_2, sse2);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s16_to_f32d, sse2);
|
2025-01-24 10:35:52 +01:00
|
|
|
DEFINE_FUNCTION(s16s_to_f32d, sse2);
|
|
|
|
|
DEFINE_FUNCTION(s16s_to_f32d_2, sse2);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24_to_f32d, sse2);
|
2019-10-24 11:06:04 +02:00
|
|
|
DEFINE_FUNCTION(s32_to_f32d, sse2);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32, sse2);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s32_noise, sse2);
|
2020-07-03 11:04:39 +02:00
|
|
|
DEFINE_FUNCTION(f32_to_s16, sse2);
|
2020-03-16 13:04:21 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_2, sse2);
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16, sse2);
|
2025-01-24 10:35:52 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16s_2, sse2);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s16s, sse2);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_noise, sse2);
|
2020-07-03 11:04:39 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d, sse2);
|
2022-07-15 12:36:15 +02:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16d_noise, sse2);
|
2022-06-30 18:24:05 +02:00
|
|
|
DEFINE_FUNCTION(32_to_32d, sse2);
|
2022-07-11 10:58:51 +02:00
|
|
|
DEFINE_FUNCTION(32s_to_32d, sse2);
|
2022-06-30 18:24:05 +02:00
|
|
|
DEFINE_FUNCTION(32d_to_32, sse2);
|
2022-07-11 10:58:51 +02:00
|
|
|
DEFINE_FUNCTION(32d_to_32s, sse2);
|
2019-03-27 17:58:48 +01:00
|
|
|
#endif
|
|
|
|
|
#if defined(HAVE_SSSE3)
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24_to_f32d, ssse3);
|
2019-03-27 17:58:48 +01:00
|
|
|
#endif
|
|
|
|
|
#if defined(HAVE_SSE41)
|
2019-03-28 21:07:53 +01:00
|
|
|
DEFINE_FUNCTION(s24_to_f32d, sse41);
|
2020-03-16 16:11:29 +01:00
|
|
|
#endif
|
|
|
|
|
#if defined(HAVE_AVX2)
|
|
|
|
|
DEFINE_FUNCTION(s16_to_f32d_2, avx2);
|
|
|
|
|
DEFINE_FUNCTION(s16_to_f32d, avx2);
|
2025-01-24 10:35:52 +01:00
|
|
|
DEFINE_FUNCTION(s16s_to_f32d, avx2);
|
|
|
|
|
DEFINE_FUNCTION(s16s_to_f32d_2, avx2);
|
2020-03-16 16:11:29 +01:00
|
|
|
DEFINE_FUNCTION(s24_to_f32d, avx2);
|
|
|
|
|
DEFINE_FUNCTION(s32_to_f32d, avx2);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s32, avx2);
|
2020-03-17 17:27:47 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_4, avx2);
|
2020-03-16 16:11:29 +01:00
|
|
|
DEFINE_FUNCTION(f32d_to_s16_2, avx2);
|
|
|
|
|
DEFINE_FUNCTION(f32d_to_s16, avx2);
|
2019-03-27 17:58:48 +01:00
|
|
|
#endif
|
2021-02-05 15:08:26 +01:00
|
|
|
|
|
|
|
|
#undef DEFINE_FUNCTION
|
2025-07-01 18:06:39 +02:00
|
|
|
|
|
|
|
|
#define DEFINE_CLEAR_FUNCTION(name,arch) \
|
|
|
|
|
void conv_clear_##name##_##arch(struct convert *conv, void * SPA_RESTRICT dst[], \
|
|
|
|
|
uint32_t n_samples)
|
|
|
|
|
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(alaw, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(ulaw, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(8, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(8d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(16, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(16d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(24, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(24d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(32, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(32d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(64, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(64d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u8, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u8d, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u16, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u24, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u24_32, c);
|
|
|
|
|
DEFINE_CLEAR_FUNCTION(u32, c);
|
|
|
|
|
|
|
|
|
|
#undef DEFINE_CLEAR_FUNCTION
|