Commit graph

70 commits

Author SHA1 Message Date
Pauli Virtanen
fe2c62b9b1 meson.build: set project cc flags also for native builds
Use the build flags also for all native build targets.
Avoids spurious warnings in spa-json-dump
2025-10-26 14:12:19 +00:00
Pauli Virtanen
2c2bed2aeb audioconvert: fix resampler delay value and add test
Resampler delay for N taps is N/2-1 input samples.

Add test that checks this.

When input rate is varying, the resampler also accumulates additional
sub-sample delay. The resampler does not currently have API to report
the instantaneous sub-sample delay.  Add knownfail test for it.
2025-01-13 19:05:58 +02:00
sunyuechi
d932e52d5b fmt-ops: add R-V V optimizations for f32_s16 2024-09-18 10:40:48 +00:00
Arun Raghavan
70a7bae5d7 resampler: Precompute some common filter coefficients
While this is quite fast on x86 (order of a few microseconds), the
computation can take a few milliseconds on ARM (measured at 1.9ms (32000
-> 48000) and 3.3ms (32000 -> 44100) on a Cortex A53).

Let's precompute some common rates so that we can avoid this overhead on
each stream (or any other audioconvert) instantiation. The approach
taken here is to write a little program to create the resampler
instance, and run that on the host at compile-time to generate some
common rate conversions.
2024-08-08 00:30:24 -04:00
Pauli Virtanen
960ca82552 spa: deduplicate test-helper.h 2023-10-15 16:20:17 +00:00
Wim Taymans
632f532036 audioconvert: don't use -Ofast on alpha
I can crash when using denormalized floats.

Fixes #3489
2023-09-07 17:44:30 +02:00
Wim Taymans
805fbd0b34 meson: remove -ffast-math
It can cause crashes in some cases and does not seem to cause much
performance loss on x86.

Fixes #3489
2023-09-06 21:32:48 +02:00
Wim Taymans
670bf8fe8f echo-cancel: add wav debug file support 2023-03-09 16:31:30 +01:00
Wim Taymans
0563e1da52 audioconvert: add debug.wav-path to save wav 2023-03-09 16:22:55 +01:00
Wim Taymans
0e4df09e53 audioconvert: add peaks test 2022-09-27 12:14:43 +02:00
Wim Taymans
a579fc49ba audioconvert: move peaks functions to separate file
Make a peaks finder helper and use it in the peaks resampler.
2022-09-27 11:25:02 +02:00
Wim Taymans
6e9e02b420 audioconvert: refactor peaks resampler
Use common code in macro and generate arch specific version.
Compile with -Ofast to optimize some fmaxf calls.
2022-09-07 16:00:31 +02:00
Wim Taymans
67754ad3bc meson: remove sse_args from plain c build 2022-07-18 13:00:12 +02:00
Wim Taymans
419517fd55 audioconvert: build C versions with -Ofast and -ffast-math
Move resampler implementations to a -c version.
Compile some of the functions with other flags to make them more
optimized.
2022-07-14 10:07:07 +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
b41d52cfd1 audioconvert: optimize dither
Add sse2 dither optimization
2022-06-27 14:15:01 +02:00
Wim Taymans
9f55708e9d audioconvert: Always apply noise when asked
Rename empty.noise -> dither.noise and always add this amount of noise
when > 0. This also adds the noise to silent sounds, not only when
nothing is connected because that would also be a problem when an amp
needs to be kept alive with an non-0 signal.

Rename noise -> dither because we can use this also for dithering later.

See #705
2022-06-27 11:19:01 +02:00
Wim Taymans
1c6cb049ce audioconvert: add an option generate silence noise
Add an empty.noise option that specifies the number of bits to
use for noise when the input signal is pure silence.

Some amplifiers can go into suspend mode pretty easily when they
get pure silence. With empty.noise = 1, audioconvert will now generate
a bitpattern that can keep those amplifiers alive, together with
disabling suspend in the session manager.

Fixes #705
2022-06-24 13:45:35 +02:00
Wim Taymans
de2e819fec audioconvert2: rename to audioconvert 2022-06-16 09:19:05 +02:00
Wim Taymans
cf04bb573c audioconvert: remove old plugins 2022-06-16 09:16:49 +02:00
Wim Taymans
7f9ddd0f15 Add audioconvert2 2022-06-16 09:09:27 +02:00
Barnabás Pőcze
ec465966bc treewide: meson.build: simplify get_variable() calls
Since 01c6fd0a88 the
minimum required meson version is 0.59.0, and since
meson 0.58.0, `get_variable()` on a dependency object
accepts a positional argument. The "type" of variable
(internal, pkgconfig, etc.) in that case does not need
to be specified explicitly.
2022-01-17 08:28:53 +00:00
Wim Taymans
126d380e85 spa-resample: don't add simd_cargs, they are not needed 2022-01-07 13:28:43 +01:00
Barnabás Pőcze
26eb66fb5b treewide: meson.build: get SPA_PLUGIN_DIR from dependency
Instead of hard-coding the path relative to the project root,
retrieve the correct path from `spa_dep`.
2021-12-28 18:39:17 +01:00
Barnabás Pőcze
8ed46a283f treewide: meson.build: use project_{build,source}_root()
Use `meson.project_{build,source}_root()` instead of
`meson.{build,source}_root()` because those functions
do not work as expected when used inside a subproject,
and they have been deprecated in meson 0.56.0.
2021-12-28 18:37:18 +01:00
Barnabás Pőcze
2b110af366 treewide: meson.build: use dependency variable for SPA
Use `spa_dep` everywhere instead of `spa_inc`,
and remove `spa_inc` altogether.
2021-12-28 18:34:06 +01:00
Peter Hutterer
0cbd56f0cd spa: declare a dependency for each used library in meson.build
For SPA libraries that we link against elsewhere in the tree, declare a
declare a dependency "foo_dep" for that library that specifies how to
link to it. Then use that dependency in the various targets.

This removes the knowledge of how to link with the library from the
target which can treat it as just another dependency.

In the case of optional libraries (e.g. the journal support lib) we can
then use declare_dependency() to declare an empty dependencies and thus
link them unconditionally in the target.
2021-09-20 07:29:03 +00:00
Nils Tonnätt
dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt
f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Peter Hutterer
5ba43b8349 audioconvert: add config.h to include directories
Some of the files here #include "config.h"
2021-06-10 09:04:16 +10:00
Peter Hutterer
e38cc427bf spa: fix indentation in audioconvert/meson.build
Was partially using spaces, partially 2-space tabs. Use 2 spaces only and fix
the few lines where the indentation was completely out of whack.
2021-06-10 09:04:16 +10:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00: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
6249b00b9a audioconvert: add volume ops
Add volume helpers and use this for the monitor output ports so
that we can add volumes to the monitor output signal as well.
2021-02-05 15:08:26 +01:00
Wim Taymans
abe73c9146 meson: use global b_pie to build PIE executables 2021-01-14 16:29:32 +01:00
Wim Taymans
c9354c238f Add -fPIE to installed executables
Fixes #570
2021-01-13 19:40:37 +01:00
Wim Taymans
28f60eaf6f spa: install the spa-resample tool 2020-09-23 11:37:16 +02:00
Simon McVittie
8dcf76f661 audioconvert tests: Default to using an installed libspa-support
This makes installed-tests (see commit b852b58f) do the right thing.
For build-time testing, spa/plugins/audioconvert/meson.build overrides
this with the SPA_PLUGIN_DIR environment variable, and for ad-hoc
testing by developers, pw-uninstalled.sh sets the necessary variables.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-14 18:16:49 +00:00
Simon McVittie
b852b58f82 Optionally install examples and tests
This makes it easier to test PipeWire in its "as-installed" state,
for example in an OS distribution.

The .test metadata files in ${datadir}/installed-tests/${package} are
a convention taken from GNOME's installed-tests initiative, allowing a
generic test-runner like gnome-desktop-testing to discover and run tests
in an automatic way.

The installation path ${libexecdir}/installed-tests/${package} is also
a convention borrowed from GNOME's installed-tests initiative.

In addition to the automated tests, I've installed example executables
in the same place, for manual testing. They could be separated into
a different directory if desired, but they seem like they have more
similarities with the automated tests than differences: both are there
to test that PipeWire works correctly, and neither should be relied on
for production use. Some examples are installed in deeper subdirectories
to avoid name clashes.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-16 17:58:02 +00:00
Wim Taymans
95906ca52e audioconvert: fix compilation 2020-04-04 20:03:11 +02:00
Wim Taymans
6937ec5e63 audioconvert: compile c version with right flags 2020-04-03 18:12:04 +02:00
Wim Taymans
0d1cef6b3a audioconvert: move some things around
To make it easier to add other implementations later.
Improve selection of resampler function
2020-04-03 18:03:42 +02:00
Wim Taymans
a81e269a7e neon: fix neon detection and compilation 2020-04-03 13:30:08 +02:00
Wim Taymans
527dc89365 fmt-ops: add neon optimizations for format conversion 2020-03-30 10:59:21 -04:00
Wim Taymans
67a5dd35be resample: add neon optimizations 2020-03-27 08:27:11 -04: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
6eca935e61 also test optimized versions 2020-03-16 13:08:33 +01:00
Wim Taymans
83f2e890ad tools: add generic resampler tool
Add a tool that can convert the sample rate of an input file and
write it to an output file. This tool can be used to test the
resampler.
2020-02-13 16:46:03 +01:00
Wim Taymans
65caf8832c spa: install in versioned directory
So that we can run old and new plugins side by side.
2020-01-29 15:51:41 +01:00