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.
This commit is contained in:
Arun Raghavan 2024-08-07 12:30:10 -04:00
parent 46f89d8009
commit 70a7bae5d7
5 changed files with 260 additions and 1 deletions

View file

@ -50,6 +50,7 @@ pipewire_confdatadir = pipewire_datadir / 'pipewire'
modules_install_dir = pipewire_libdir / pipewire_name
cc = meson.get_compiler('c')
cc_native = meson.get_compiler('c', native: true)
if cc.has_header('features.h') and cc.get_define('__GLIBC__', prefix: '#include <features.h>') != ''
# glibc ld.so interprets ${LIB} in a library loading path with an
@ -112,6 +113,8 @@ cc_flags = common_flags + [
]
add_project_arguments(cc.get_supported_arguments(cc_flags), language: 'c')
cc_flags_native = cc_native.get_supported_arguments(cc_flags)
have_cpp = add_languages('cpp', native: false, required : false)
if have_cpp
@ -276,6 +279,7 @@ configure_file(input : 'Makefile.in',
# Find dependencies
mathlib = cc.find_library('m', required : false)
mathlib_native = cc_native.find_library('m', required : false)
rt_lib = cc.find_library('rt', required : false) # clock_gettime
dl_lib = cc.find_library('dl', required : false)
pthread_lib = dependency('threads')