Commit graph

98 commits

Author SHA1 Message Date
Wim Taymans
22a210e798 channelmix: 1 channel MONO or FC should be handled the same.
They were handled the same, remove the wrong line to attempt to
make them different.
2021-12-09 17:19:22 +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
ce02c7d435 channelmix: always handle 1 channel as mono
Handle 1 channel as a mono channel, which gets copied to all outputs
or gets the average of all inputs.

Fixes the case where a mono channel is handled like a FRONT channel
and then gets attenuated when mixed into left and right.
2021-12-09 16:03:32 +01:00
Wim Taymans
70722c0741 channelmix: provide some more upmix options
If nothing else is possible, also try to upmix from FC

See #1237
2021-05-27 18:08:07 +02:00
Wim Taymans
15239ff74d channelmix: only run the LFE filter when upmixing
Only run the lowpass filter on the LFE channel when we are upmixing
and there is a valid cutoff frequency defined.

Otherwise we might filter away a valid LFE channel.

Fixes: rhbz#1941366
2021-05-03 11:50:47 +02:00
Andrea Gelmini
47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00: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
71824d0b03 audioconvert: debug selected function name in channelmix 2021-04-26 17:33:45 +02:00
Wim Taymans
fa3bd6b0e1 channelmix: support more than 19 channels
The channelmatrix was limited to the 19 known channels, leaving
only the first 19 channels usable.

Use the full 64x64 matrix instead and make sure to fill all 64
channels with the identity matrix in the case we need to copy or
distribute the matrix to unknown positions.

See #57
2021-04-16 10:56:24 +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
c7309f0248 channelmix: small cleanups
Fix indent
Rename DUAL/QUAD to REAR and SIDE and use it for checking availability
of stereo pairs.
2021-03-06 21:29:36 +01:00
fdev31
4d21b5f8bd Simple upmix of stereo inputs up to 7.1 output 2021-03-06 20:22:09 +00:00
Wim Taymans
6b0abd2057 channelmix: Improve unknown channel layout handling
Clamp position to valid range. so that AUX becomes UNKNOWN.
If we have one mono source channel and unknown destination, copy it
to all destination channels.
If we have one mono destination channel and unknown source layout,
average all channels.
Otherwise, pair source and dest channels.

See #538
2021-01-15 17:51:07 +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
700a0aa35c Fix FLC+FRC to FL+FR 2020-09-29 12:02:30 +02:00
Wim Taymans
df3394a694 add some more debug 2020-09-29 12:02:25 +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
b62fa9faf2 channelmix: disable normalize for now
Volume is too low and we don't choose the right functions all the
time. Needs more work.
2020-09-02 18:50:01 +02:00
Wim Taymans
5dea431372 channelmix: normalize matrix to avoid clipping 2020-09-02 18:36:42 +02:00
Wim Taymans
0d35f44fd9 tests: add channelmix test 2019-08-29 14:05:02 +02:00
Wim Taymans
954c96632c channelmix: try to handle 1 channel as MONO/FC 2019-08-16 15:03:16 +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
d46c239ab0 some printf fixes 2019-06-07 16:37:08 +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
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
ac5ec9bbe2 device: improve callbacks
Pass info structures to device callbacks to make it more extensible.
Also notify about the supported params on the device because we
can.
2019-02-13 11:13:46 +01:00
Wim Taymans
13bf70a8dd mem: align memory to requested alignment
Improve the allocators to always align the buffer memory to the
requested alignment
Use aligned read and writes for sse functions and check alignment,
optionally falling back to unaligned path.
Add more tests and benchmark cases
Check and warn for misaligned memory in plugins.
2019-01-24 18:28:52 +01:00
Wim Taymans
e918f9f77c fix sign confusion 2019-01-07 15:52:42 +01:00
Wim Taymans
b6db6e2130 channelmix: add quad and 3.1 to mono optimisation 2018-12-19 16:49:29 +01:00
Wim Taymans
4dfe1011a6 audioconvert: use cpu detection interface 2018-12-17 13:26:54 +01:00
Wim Taymans
5025aa97e6 audioconvert: fix x86 feature defines 2018-12-17 10:20:18 +01:00
Wim Taymans
6ee3a6003e channelmix: optimize some more 2018-11-21 16:45:31 +01:00
Wim Taymans
85f2e93c54 Relicense as MIT/X11
Remove some obsolete files
2018-11-05 17:48:52 +01:00
Wim Taymans
6e6e87223f channelmix: improve mute/volume handling
Don't try to merge the mute/volume into the matrix but pass the volume
as a separate parameter.
2018-10-15 17:57:23 +02:00
Wim Taymans
64c38e3a6f channelmix: construct matrix and use coefficients 2018-09-18 17:06:47 +02:00
Wim Taymans
61cc453cbe channelmix: mix some LFE as well 2018-09-18 12:32:46 +02:00
Wim Taymans
20cbbd2cc9 explicitly allow mono and stereo with unknown layouts 2018-09-17 17:15:22 +02:00
Wim Taymans
78b7da608f channelmix: more improvements
work with the default channel layout
remap to default channel layout in fmconvert
Pass channel positions in resample format
2018-09-17 09:41:41 +02:00
Wim Taymans
5196f7f053 audio: remove layout from audio
Make special format types for planar and interleaved instead of
having a field.
Add enum for audio channel positions
Add some default audio channel layouts
Place the channel layout in the audio format when possible
alsa: place audio channel positions in format
Add sse optimized channel mixing for some common cases
Remove name from port info, it's not mandatory and in the properties
Add direction to port info
2018-09-13 17:03:56 +02:00
Wim Taymans
8f97e0dd31 audioconvert: add volume control 2018-07-03 21:34:22 +02:00
Wim Taymans
b3b47d3fe9 more work on audioconvert
Implement audioconvert as a complex element of fmtconver,
channelmix and resample.
Make copying resample just to test.
Plug the converter into pw_stream.
2018-04-10 15:54:29 +02:00
Wim Taymans
142ef38df9 stream: more work on converter 2018-04-06 18:39:40 +02:00