Commit graph

40 commits

Author SHA1 Message Date
Wim Taymans
13b8c23767 Don't use SPA_AUDIO_MAX_CHANNELS directly
Make a MAX_CHANNELS define and use that one in code. This makes it
easier to change the constant later.
2025-10-21 09:43:06 +02:00
Wim Taymans
2c132be626 audioconvert: align some buffers
so that we can use aligned read and writes in SSE.
2024-10-23 12:54:23 +02:00
Wim Taymans
662bf68122 audioconvert: handle odd writes in delay
Add some padding to the delay buffer. If we wrap around, copy the
spilled samples to the front of the buffer. This makes it possible to
use the more optimized sse delay function in more cases.
2024-10-23 12:34:04 +02:00
Wim Taymans
2c0ce6afc2 audioconvert: SSE optimize delay and convolver 2024-10-15 16:10:25 +02:00
Wim Taymans
33fb2f04c7 audioconvert: use MAX_TAPS constant 2024-10-15 12:49:16 +02:00
Wim Taymans
a57f2f25b6 delay: improve delay performance
Use a wrap around delay ringbuffer. We can then avoid some modulo
arithmetic and read more efficiently.

Also handle the delay convolver case better by reversing the taps and
reading the taps and delay buffer without extra overhead.
2024-10-15 12:14:57 +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
9efb2e3463 audioconvert: optimize upmix functions with SSE 2022-10-13 10:19:04 +02:00
Wim Taymans
9b6e504c19 clean up some more array iterations 2022-10-03 09:20:42 +02:00
Wim Taymans
637bc6f7c4 channelmix: add optimised NxM channelmix functions 2022-09-28 17:50:59 +02:00
Wim Taymans
51f4f1fb69 audioconvert: expose the selected function names
And debug them.
2022-06-28 16:50:14 +02:00
Wim Taymans
048e10ee3b audioconvert: expose upmix-method in PROP_INFO 2022-06-28 11:32:05 +02:00
Wim Taymans
9430df0ba6 channelmix: undefine the function macro 2022-06-24 13:45:35 +02:00
Wim Taymans
da95043002 channelmix: guard against invalid channels 2022-06-23 11:40:22 +02:00
Wim Taymans
7f9ddd0f15 Add audioconvert2 2022-06-16 09:09:27 +02:00
Wim Taymans
8e1f0628f7 channelmix: add 3p1_2 and use this for quad conversions
Simplify some SSE versions
2022-06-13 20:35:00 +02:00
Ole Salscheider
354a04c91d Channel mixer: Remove channelmix_f32_2_4_sse
It does not have PSD upmixing implemented and does not allow to disable
the simple upmixing algorithm either.

Fixes #2438.
2022-06-13 14:19:23 +00:00
Wim Taymans
66e4334c92 channelmix: reuse more functions
Make some copy/vol functions and reuse them.
Reuse the 2->3p1 upmix code, tweak it a little to that the widen
param is always used.
2022-04-12 11:54:27 +02:00
Wim Taymans
bc5b486cb9 channelmix: add simple upmix method
Add a property to select the upmix method. PSD is enabled by default
but a new simple upmixing algorithm is available that duplicates
channels and avoids lowpass filter on the FC and disables widening.

Fixes #861
2022-03-14 15:33:07 +01:00
Wim Taymans
23db50630d channelmix: add option to filter FC
Add an option to do a lowpass filter on the FC channel to isolate
the voices better and move the higher frequencies to the stereo
channels.

See #861
2022-03-01 11:30:12 +01:00
Wim Taymans
5b3388e4ac audioconvert: add optional hilbert transform to rear channels
Add an option to do a hilbert transform on the generated rear channels
to do a 90 degree pahse shift on them. This can improve spacialization
of the rear channels.

See #861
2022-03-01 11:09:43 +01:00
Wim Taymans
5dd0a12875 channelmix: add option for stereo widen
When generating FC, add an option to subtract some of the generated
FC from the FL and FR channel to move the sound more to the center.

See #861
2022-03-01 10:28:11 +01:00
Wim Taymans
5a307c11e1 audioconvert: add delay to rear channels when upmixing
See #861
2022-03-01 09:56:12 +01:00
Wim Taymans
d62d2764e8 channelmix: improve corssover processing
Apply volume after crossover, optimize when disabled or silent.
2022-03-01 09:08:17 +01:00
Wim Taymans
2e8e8938bc channelmix: add stereo to 7.1 upmix 2022-02-24 16:09:14 +01:00
Wim Taymans
b1ca470d99 channelmix: don't pass channels around
We have this info in the channelmix structure.
2022-02-24 13:09:25 +01:00
Wim Taymans
92198e4d0d spa: clamp required alignment to cpu alignment
pipewire will allocate buffers aligned to the max alignment required for
the CPU. Take this into account and don't expect larger alignment.

Fixes a warning in mixer-dsp when the CPU max alignment is 16 but the
plugin requires 32 bytes alignment for the AVX2 path (that would never
be chosen on the CPU).

See #2074
2022-01-28 11:49:06 +01:00
Wim Taymans
6b34b8c44e audioconvert: fix mono channel mix test
When we have a single MONO channel, distribute and average. Otherwise,
use the logic to do proper mixing.

Adjust the unit test accordingly.
2021-12-09 16:51:40 +01:00
Wim Taymans
5724093343 audioconvert: run lr4 on tagged channels in generic case
Mark the LFE channels and run the lowpass filter on them in
the generic case. Generates LFE correctly in 2.1 upmix case.

See #1095
2021-04-26 17:34:14 +02:00
Wim Taymans
14e8073d18 audioconvert: add LFE filter
Use a lowpass filter to generate LFE from the stereo channels.
2021-03-17 11:28:40 +01:00
Wim Taymans
e51cc5b537 channelmix: Prepare for generating LFE channel
Add channelmix.lfe-cutoff property, 0 is disabled
Disable upmix by default
2021-03-17 11:09:19 +01:00
Wim Taymans
6324298bc5 channelmix: add more generic upmixing
Add options to enable lfe filtering and upmix.
Enable upmix by default, lfe is disabled because we don't actually
do a lowpass filter yet.
2021-03-06 21:31:18 +01:00
Wim Taymans
f70d0b19af channelmix: add option to NORMALIZE volumes
Normalize the complete matrix with the same coefficient
2020-09-29 12:02:34 +02:00
Wim Taymans
9a7cbeea83 channelmix: improve undefined channel layout
When we have no channel layout, just copy input to output
channel.
Optimize this case in the mixer implementation.
2020-09-04 13:41:24 +02:00
Wim Taymans
f7d8fef070 channelmix: normalize volumes
Normalize the volumes.
Don't mix in LFE by default but add an option
Move some booleans to flags
Improve some checks for fastpaths.
2020-09-03 13:20:36 +02:00
Wim Taymans
87ae7a8011 channelmix: apply channel volumes correctly 2019-08-14 14:56:16 +02:00
Wim Taymans
c6a7b3eedb channelmix: implement per channel volume
Implement per channel volume on channelmix. Extend control on stream to
take an array of values when possible.

Remove name argument from pw_node_new and pw_device_new. We can pass
this as a property instead.

Improve properties on nodes to more closely match what pulseaudio does.
Don't let the monitor do too much with the udev properties but let the
session manager set the description and icon-names.

Remove some change_mask flags for things that don't change in
introspect. Use the flags to mark changes in -cli and -monitor.
2019-08-12 15:14:39 +02:00
Wim Taymans
092a0c660d make bitfields unsigned
Remove driver property from client-node of client-stream.
2019-04-10 17:52:42 +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