mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
mixer: Move floatmix to the audio mixer plugin
Move floatmix to the audiomixer plugin and change the name to AUDIO_MIXER_DSP. Add runtime selectable sse and sse2 optimizations. Load the port mixer plugin dynamically based on the factory_name. Add some more debug
This commit is contained in:
parent
27eabede35
commit
0ecbe4844e
13 changed files with 482 additions and 404 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* Spa
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
* Copyright © 2019 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -22,35 +22,40 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
|
||||
typedef void (*mix_clear_func_t) (void *dst, int n_bytes);
|
||||
typedef void (*mix_func_t) (void *dst, const void *src, int n_bytes);
|
||||
typedef void (*mix_scale_func_t) (void *dst, const void *src, const double scale, int n_bytes);
|
||||
typedef void (*mix_i_func_t) (void *dst, int dst_stride,
|
||||
const void *src, int src_stride, int n_bytes);
|
||||
typedef void (*mix_scale_i_func_t) (void *dst, int dst_stride,
|
||||
const void *src, int src_stride, const double scale, int n_bytes);
|
||||
struct mix_ops {
|
||||
uint32_t fmt;
|
||||
uint32_t n_channels;
|
||||
uint32_t cpu_flags;
|
||||
|
||||
enum {
|
||||
FMT_S16,
|
||||
FMT_F32,
|
||||
FMT_MAX,
|
||||
void (*clear) (struct mix_ops *ops, void * SPA_RESTRICT dst, uint32_t n_samples);
|
||||
void (*process) (struct mix_ops *ops,
|
||||
void * SPA_RESTRICT dst,
|
||||
const void * SPA_RESTRICT src[], uint32_t n_src,
|
||||
uint32_t n_samples);
|
||||
void (*free) (struct mix_ops *ops);
|
||||
|
||||
const void *priv;
|
||||
};
|
||||
|
||||
struct spa_audiomixer_ops {
|
||||
mix_clear_func_t clear[FMT_MAX];
|
||||
mix_func_t copy[FMT_MAX];
|
||||
mix_func_t add[FMT_MAX];
|
||||
mix_scale_func_t copy_scale[FMT_MAX];
|
||||
mix_scale_func_t add_scale[FMT_MAX];
|
||||
mix_i_func_t copy_i[FMT_MAX];
|
||||
mix_i_func_t add_i[FMT_MAX];
|
||||
mix_scale_i_func_t copy_scale_i[FMT_MAX];
|
||||
mix_scale_i_func_t add_scale_i[FMT_MAX];
|
||||
};
|
||||
int mix_ops_init(struct mix_ops *ops);
|
||||
|
||||
void spa_audiomixer_get_ops(struct spa_audiomixer_ops *ops);
|
||||
#define mix_ops_clear(ops,...) (ops)->clear(ops, __VA_ARGS__)
|
||||
#define mix_ops_process(ops,...) (ops)->process(ops, __VA_ARGS__)
|
||||
#define mix_ops_free(ops) (ops)->free(ops)
|
||||
|
||||
#define DEFINE_FUNCTION(name,arch) \
|
||||
void mix_##name##_##arch(struct mix_ops *ops, void * SPA_RESTRICT dst, \
|
||||
const void * SPA_RESTRICT src[], uint32_t n_src, \
|
||||
uint32_t n_samples) \
|
||||
|
||||
DEFINE_FUNCTION(f32, c);
|
||||
DEFINE_FUNCTION(f64, c);
|
||||
|
||||
#if defined(HAVE_SSE)
|
||||
DEFINE_FUNCTION(f32, sse);
|
||||
#endif
|
||||
#if defined(HAVE_SSE2)
|
||||
DEFINE_FUNCTION(f64, sse2);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue