audioconvert: ensure alignment

Allocate a little bit more data to ensure alignment and overread of the
dither data.
Ensure sse2 can load aligned data in all cases.
This commit is contained in:
Wim Taymans 2022-06-27 17:18:23 +02:00
parent b41d52cfd1
commit 00998ffd7e
4 changed files with 19 additions and 18 deletions

View file

@ -29,6 +29,9 @@
#include <spa/utils/string.h>
#include <spa/param/audio/raw.h>
#define DITHER_OPS_MAX_ALIGN 16
#define DITHER_OPS_MAX_OVERREAD 16
struct dither {
uint32_t intensity;
#define DITHER_METHOD_NONE 0
@ -45,7 +48,7 @@ struct dither {
const void * SPA_RESTRICT src[], uint32_t n_samples);
void (*free) (struct dither *d);
uint32_t random[16];
uint32_t random[16 + DITHER_OPS_MAX_ALIGN/sizeof(uint32_t)];
float *dither;
uint32_t dither_size;
float scale;
@ -83,8 +86,6 @@ void dither_##name##_##arch(struct dither *d, \
const void * SPA_RESTRICT src[], \
uint32_t n_samples);
#define DITHER_OPS_MAX_ALIGN 16
DEFINE_FUNCTION(f32, c);
#if defined(HAVE_SSE2)
DEFINE_FUNCTION(f32, sse2);