Wim Taymans
f7c3d37969
fmt-ops: allocate shaper memory dynamically
...
It is based on the number of channels so allocate it dynamically.
2025-10-24 12:46:38 +02:00
Wim Taymans
0817001728
audioconvert: add clear function
...
Sets all samples to 0 in the target format.
2025-07-02 10:27:26 +02:00
Wim Taymans
0c8f803d59
audioconvert: optimise f32d to/from s16s conversions
...
They are mostly used for sending and receiving RTP so it might be worth
to make them a bit faster.
2025-01-24 10:37:02 +01:00
sunyuechi
245adda985
fmt-ops: add RVV optimizations for s32_to_f32d
2024-09-29 11:17:42 +08:00
sunyuechi
79d41e183e
fmt-ops: add RVV optimizations for f32d_to_s32
2024-09-26 00:55:49 +08:00
sunyuechi
74832445ba
fmt-ops: add RVV optimizations for s16_to_f32d
2024-09-25 10:50:05 +00:00
sunyuechi
8a8843ba20
fmt-ops: add RVV optimizations for f32d_s16
2024-09-23 08:10:43 +00:00
sunyuechi
852de6c35c
fmt-ops: add RVV optimizations for f32d_s16d
2024-09-23 08:10:43 +00:00
sunyuechi
d932e52d5b
fmt-ops: add R-V V optimizations for f32_s16
2024-09-18 10:40:48 +00:00
Wim Taymans
b421331275
doc: clarify the dither.noise
...
Fixes #4057
2024-06-13 11:38:26 +02:00
Barnabás Pőcze
934ab3036e
treewide: use SPDX tags to specify copyright information
...
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.
See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
d22feab92a
spa: add macro to simplify array iterations some more
...
uint32_t i;
for (i = 0; i < SPA_N_ELEMENTS(some_array); i++)
.. stuff with some_array[i].foo ...
becomes:
SPA_FOR_EACH_ELEMENT_VAR(some_array, p)
.. stuff with p->foo ..
2022-09-30 16:24:26 +02:00
Wim Taymans
a145c42ec4
audioconvert: make separate noise functions
...
So that we can reuse optimized versions in unoptimized noise
functions.
Do allocation a little different so that we can align everything
from the start.
2022-09-29 21:36:06 +02:00
Wim Taymans
ada39f3048
audioconvert: improve noise bits
...
Make a new noise method called PATTERN and use it to add a slow (every
1024 samples) repeating pattern of -1, 0.
Only use this method when we don't already use triangular dither.
See #2540
2022-07-18 11:41:57 +02:00
Wim Taymans
57f63feb92
audioconvert: Fix Wannamaker name
2022-07-18 10:22:21 +02:00
Wim Taymans
a4db745a7e
audioconvert: improve noise shaping
...
Reorganize things a little so we can add more noise shapers.
Add sloped triangular noise.
Add wanamaker3 noise shaping.
2022-07-15 12:36:15 +02:00
Wim Taymans
7745346292
audioconvert: add sse2 s16 dither functions
2022-07-12 10:34:13 +02:00
Wim Taymans
c35006f040
audioconvert: move scaling to setup
2022-07-11 17:50:20 +02:00
Wim Taymans
68f883ff77
audioconvert: fix dither scale
...
Rectangular dither should be [-0.5, 0.5]
Triangular dither should be [-1.0, 1.0]
Noise should add extra bits.
2022-07-11 17:19:28 +02:00
Wim Taymans
dd1d5960b4
audioconvert: implement f64s
...
Add swapping functions for f64s.
Fix the awkward interleave/deinterleave names for 32s.
2022-07-11 10:58:51 +02:00
Wim Taymans
06b1cf8663
audioconvert: implement (de)interleave with existing functions
2022-06-30 18:24:05 +02:00
Wim Taymans
9b37142ef6
audioconvert: implement noise shaping
...
To compare the results:
pw-cat -r test.wav --format=u8 -P '{ dither.method=none }'
vs:
pw-cat -r test.wav --format=u8 -P '{ dither.method=shaped5 }'
2022-06-29 17:33:37 +02:00
Wim Taymans
938f2b123e
audioconvert: improve format conversion
...
Make dither noise as a value between -0.5 and 0.5 and add this
to the scaled samples.
For this, we first need to do the scaling and then the CLAMP to
the target depth. This optimizes to the same code but allows us
to avoid under and overflows when we add the dither noise.
Add more dithering methods.
Expose a dither.method property on audioconvert. Disable dither when
the target depth > 16.
2022-06-29 14:10:15 +02:00
Wim Taymans
22d02a7891
audioconvert: dither in 24 bits
...
This saves some shifts.
2022-06-28 17:15:27 +02:00
Wim Taymans
7a0f201dc7
audioconvert: set right flags for functions
2022-06-28 17:02:15 +02:00
Wim Taymans
6b49bded3a
audioconvert: move dither and noise to fmt-ops
...
We need to do dithering and noise when converting f32 to the
target format. This is more natural because we can work in 32 bits
integers instead of floats.
This will also make it possible to actually calculate the error between
source and target values and implement some sort of feedback and
noise shaping later.
2022-06-28 16:55:50 +02:00
Wim Taymans
734470f0cd
audioconvert: add SSE (de)interleave_32(s) versions
2022-03-11 15:02:02 +01:00
Wim Taymans
9f5caa6358
audioconvert: add f64 conversion
...
See #1990
2022-01-10 13:04:31 +01:00
Wim Taymans
0ace131d72
audioconvert: add stereo deinterleave neon asm
...
This can take some shortcuts and convert twice as many samples in one
iteration as the strided stereo deinterleave one.
2021-10-28 11:30:04 +02:00
Julian Bouzas
20e64b39da
fmtconvert: add support for U16, U24, U32 and U24_32 formats
2021-09-08 14:24:26 -04:00
Wim Taymans
df9f79d869
audioconvert: add converstion to and from alaw/ulaw
2021-08-17 17:32:25 +02:00
Wim Taymans
a5e2e955d2
audioconvert: add more conversions
...
Add the other endian conversions.
2021-08-17 14:45:00 +02:00
George Kiagiadakis
bc1f9d304f
audioconvert: handle S8/S8P raw audio formats
2021-05-05 08:56:59 +03:00
Wim Taymans
a8faad9f17
fmt: support f32p -> s24s conversion
...
As used by MAudio Fasttrack Pro
See rhbz#916017
2021-01-14 17:58:54 +01:00
Wim Taymans
a520335581
fmt-ops: add sse2 version of f32 to s16 planar/interleaved
2020-07-03 11:05:26 +02:00
Wim Taymans
1b3aaba206
fmt-ops: set the right flags on optimized functions
...
Or else we could select an avx2 version on a non-capable CPU.
Fixes #227
2020-04-02 17:34:47 +02:00
Wim Taymans
527dc89365
fmt-ops: add neon optimizations for format conversion
2020-03-30 10:59:21 -04:00
Wim Taymans
949dba7bfc
fmt-ops: flesh out avx optimizations
2020-03-17 17:27:47 +01:00
Wim Taymans
3a911dfe3b
fmt-ops: add avx2 optimized version
...
Only one optimized version but the sse2 version are compiled with
the avx2 flags so that they get optimized better.
2020-03-16 16:11:29 +01:00
Wim Taymans
fd3dd14ebe
fmt-ops: add optimized f32 to s16 stereo conversion
2020-03-16 13:04:21 +01:00
Wim Taymans
f4387e0568
fmt-ops: add support for s24 with endian conversion
2020-01-27 15:46:25 +01:00
Wim Taymans
3c9aa2e96c
fmt: add sse2 optimized s32->f32d
2019-10-24 11:06:04 +02:00
Wim Taymans
d8e399dee9
audioconvert: pass state to functions
...
Pass some state to convert and channelmix functions. This makes it
possible to select per channel optimized convert functions but
also makes it possible to implement noise shaping later.
Pass the channelmix matrix and volume in the state.
Handle specialized 2 channel s16 -> f32 conversion
2019-03-29 17:39:59 +01:00
Wim Taymans
d260cb19be
audioconvert: compile c version separately
...
Also compile the c versions in a separate module with their own
flags.
2019-03-28 21:07:53 +01:00
Wim Taymans
c8d3d475bb
audioconvert: handle more optimizations
...
Compile an optimized library for the given CPU with the right flags,
then link it with the main library.
2019-03-27 17:58:48 +01:00
Wim Taymans
ecc3e78ad4
fmt-ops: use faster f32 -> s32 conversion
2019-03-26 17:24:14 +01:00
Wim Taymans
0505f2dc98
audioconvert: implement passthrough
...
Add some const and SPA_RESTRICT to methods
When the input and output is the same, work in passthrough mode
where we simply copy place the input pointer onto the output buffer
without doing a memcpy.
Do memcpy when the resampler is not active.
2019-03-20 19:29:14 +01:00
Wim Taymans
74cf412f47
utils: add debugable spa_memcpy
2019-03-20 19:27:46 +01:00
Wim Taymans
fa3bcabbca
audioconvert: some more optimizations
2019-03-20 13:04:44 +01:00
George Kiagiadakis
d9c2f77cfe
spa/audioconvert: don't include xmmintrin.h in the non-sse fmt-ops
...
Fixes compilation for arm
2019-02-13 11:22:57 +01:00