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
e355df3785
channelmix: fix channel_mask bits iteration
...
Iterate the number of bits in the channel mask based on the number of
bits in the mask, not the max amount of channel positions.
2025-04-04 17:06:43 +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
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
ad84c45c0c
audioconvert: optimize lr4 handling
...
Make an SSE optimized LR4 function and one that handles 2 LR4s in
parallel.
2024-10-15 12:20:04 +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
Wim Taymans
1ae4374ccf
Fix compilation with -Werror=float-conversion
...
Better make the conversions explicit so that we don't get any surprises.
Fixes #4065
2024-06-18 12:17:56 +02:00
Wim Taymans
3decaa6457
audioconvert: use spa_strbuf
2023-03-22 15:41:27 +01: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
2895961b48
audioconvert: improve channelmix with unknown layouts
...
Use a 0 mask to handle unknown layouts. When the source or destination
is an unknown layout, pair, distribute or average. When pairing, keep
track how we paired and use that to construct the matrix later.
This fixes [ UNK UNK ] -> [ FL FR ] mapping by pairing.
2023-02-14 11:57:04 +01:00
Wim Taymans
b9999b292d
channelmix: improve mixing setup
...
Handle MONO layout as a real layout, not just like FC. This means it
does not share the FC mixing weights.
Only distribute and combine MONO channels when the target is also
MONO, enable normalization in this case.
Otherwise downmix and upmix the mono channels like any other channel,
which will make it respect the upmix and other settings.
Change some tests with this new way of doing things.
Fixes #3010
2023-02-06 21:05:23 +01:00
Wim Taymans
9c2b2a64f0
audioconvert: improve debug output
...
Print channelmix matrix when there is something to print. Avoids
skipping zero matrix lines in some cases.
2022-12-16 19:50:45 +01:00
Wim Taymans
8d4fe59764
audioconvert: improve debug
...
When we are mixing unnamed channels, place MONO in the debug output.
2022-12-12 09:38:51 +01:00
Wim Taymans
25e3144887
audioconvert: skip upmix when moving channels
...
When we use SIDE for REAR, don't try to upmix REAR channels and vice
versa.
2022-11-09 09:24:03 +01:00
Wim Taymans
cadb7b4910
audioconvert: set SSE flag on SSE function
...
Or else it might be selected even when we don't run on an SSE capable
machine.
2022-11-08 18:09:02 +01:00
Wim Taymans
c8e2c4fcd6
audioconvert: debug the conversion matrix with info level
2022-11-08 17:39:16 +01:00
Wim Taymans
9cfc0eff48
audioconvert: upmix RC
2022-11-08 17:38:55 +01:00
Wim Taymans
9efb2e3463
audioconvert: optimize upmix functions with SSE
2022-10-13 10:19:04 +02: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
a30b335beb
channelmix: leave volume unchanged for unknown channel volumes
...
When we get an unknown number of channels, don't do anything, like it
used to be.
2022-09-29 12:44:42 +02:00
Wim Taymans
25cf4d0a31
channelmix: use volume/mute when no channel volumes
...
When setting a volume without channel volumes, use the volume/mute
instead of doing nothing.
2022-09-29 12:35:52 +02:00
Wim Taymans
b7928799e5
channelmix: fix normalization
...
Don't count the sum for unused matrix coefficients. When doing pairing,
we set the mask to ~0 and so we would otherwise count too much.
Apply normalization to the active matrix coefficients, not whatever the
loop variables end up being at the end of the loops.
2022-09-29 12:29:36 +02:00
Wim Taymans
3b507e062c
channelmix: improve debug
2022-09-29 12:26:28 +02:00
Wim Taymans
637bc6f7c4
channelmix: add optimised NxM channelmix functions
2022-09-28 17:50:59 +02:00
Wim Taymans
187006f30e
audioconvert: remove some double defines
2022-09-07 16:08:21 +02:00
Wim Taymans
0c47ab76a7
channelmix: Only filter FC/LFE when present
2022-09-05 13:22:40 +02:00
Wim Taymans
3df0fb21a0
channelmix: only produce REAR/SIDE from FC in simple upmix
...
Only simple upmixing would replicate the FC channel into REAR/SIDE.
The PSD method would take the diff between FL/FR (which would
be 0 if only FC is available) and not generate output.
2022-08-11 09:37:43 +02:00
Wim Taymans
da9868594d
channelmix: produce STEREO from FC
...
Make it possible to produce STEREO from FC.
2022-08-11 09:35:54 +02:00
Wim Taymans
b03b57c77a
channelmix: also filter FC and LFE when no layout
...
Always apply filter based on dest layout, even when distributing,
averaging or copying a signal.
2022-08-11 09:33:34 +02:00
Wim Taymans
51f4f1fb69
audioconvert: expose the selected function names
...
And debug them.
2022-06-28 16:50:14 +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
Ole Salscheider
3695611b20
channelmix: Assign slev in mixing matrix when generating side/rear from front
...
This way, PSD upmixing sounds much more natural and is in line with the
original publication.
2022-06-14 10:58:25 +00: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
e12e4295cf
channelmix: only filter FC and LFE when upmixed
...
When we have an original source with LFE and FC, don't try to mix
it but pass it unmodified.
Fixes #2280
2022-04-12 11:51:01 +02:00
Wim Taymans
54f6f9293e
channelmix: upmix disabled also disables FC and LFE generation
...
Don't generate FC and LFE when upmix is disabled.
Fixes #2266
2022-04-04 09:08:54 +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
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
7241bf3c54
channelmix: remove LFE when cutoff is <= 0.0
2022-02-25 11:13:04 +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
b7279a1728
channelmix: dont make FC from synthesized FC
...
When we have stereo and need to make FC, don't try to upmix the
stereo into FC again.
Fix unit test now that we create FC channels.
2022-01-11 17:25:38 +01:00
Wim Taymans
59042251ee
channelmix: also keep FC channel
...
When the target has FC, make it from FL and FR in all cases.
2022-01-11 14:47:17 +01:00
Wim Taymans
c9efae4334
channelmix: do LFE upmix when lfe_cutoff is set
...
Require only the lfe_cutoff be set when generating LFE.
This way you can only generate LFE without having to enable upmix
for all other channels.
2022-01-11 12:44:36 +01:00