channelmix: add 3p1_2 and use this for quad conversions

Simplify some SSE versions
This commit is contained in:
Wim Taymans 2022-06-13 11:48:30 +02:00
parent c1a61a7941
commit 8e1f0628f7
4 changed files with 187 additions and 210 deletions

View file

@ -310,6 +310,32 @@ channelmix_f32_2_7p1_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
}
}
/* FL+FR+FC+LFE -> FL+FR */
void
channelmix_f32_3p1_2_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
const void * SPA_RESTRICT src[], uint32_t n_samples)
{
uint32_t n;
float **d = (float **) dst;
const float **s = (const float **) src;
const float v0 = mix->matrix[0][0];
const float v1 = mix->matrix[1][1];
const float clev = (mix->matrix[0][2] + mix->matrix[1][2]) * 0.5f;
const float llev = (mix->matrix[0][3] + mix->matrix[1][3]) * 0.5f;
if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
clear_c(d[0], n_samples);
clear_c(d[1], n_samples);
}
else {
for (n = 0; n < n_samples; n++) {
const float ctr = clev * s[2][n] + llev * s[3][n];
d[0][n] = s[0][n] * v0 + ctr;
d[1][n] = s[1][n] * v1 + ctr;
}
}
}
/* FL+FR+FC+LFE+SL+SR -> FL+FR */
void
channelmix_f32_5p1_2_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
@ -372,13 +398,9 @@ void
channelmix_f32_5p1_4_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
const void * SPA_RESTRICT src[], uint32_t n_samples)
{
uint32_t i, n, n_dst = mix->dst_chan;
uint32_t i, n_dst = mix->dst_chan;
float **d = (float **) dst;
const float **s = (const float **) src;
const float clev = mix->matrix[0][2];
const float llev = mix->matrix[0][3];
const float v0 = mix->matrix[0][0];
const float v1 = mix->matrix[1][1];
const float v4 = mix->matrix[2][4];
const float v5 = mix->matrix[3][5];
@ -387,11 +409,8 @@ channelmix_f32_5p1_4_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
clear_c(d[i], n_samples);
}
else {
for (n = 0; n < n_samples; n++) {
const float ctr = s[2][n] * clev + s[3][n] * llev;
d[0][n] = s[0][n] * v0 + ctr;
d[1][n] = s[1][n] * v1 + ctr;
}
channelmix_f32_3p1_2_c(mix, dst, src, n_samples);
vol_c(d[2], s[4], v4, n_samples);
vol_c(d[3], s[5], v5, n_samples);
}

View file

@ -26,46 +26,104 @@
#include <xmmintrin.h>
static inline void clear_sse(float *d, uint32_t n_samples)
{
memset(d, 0, n_samples * sizeof(float));
}
static inline void copy_sse(float *d, const float *s, uint32_t n_samples)
{
spa_memcpy(d, s, n_samples * sizeof(float));
}
static inline void vol_sse(float *d, const float *s, float vol, uint32_t n_samples)
{
uint32_t n, unrolled;
if (vol == 0.0f) {
clear_sse(d, n_samples);
} else if (vol == 1.0f) {
copy_sse(d, s, n_samples);
} else {
__m128 t[4];
const __m128 v = _mm_set1_ps(vol);
if (SPA_IS_ALIGNED(d, 16) &&
SPA_IS_ALIGNED(s, 16))
unrolled = n_samples & ~15;
else
unrolled = 0;
for(n = 0; n < unrolled; n += 16) {
t[0] = _mm_load_ps(&s[n]);
t[1] = _mm_load_ps(&s[n+4]);
t[2] = _mm_load_ps(&s[n+8]);
t[3] = _mm_load_ps(&s[n+12]);
_mm_store_ps(&d[n], _mm_mul_ps(t[0], v));
_mm_store_ps(&d[n+4], _mm_mul_ps(t[1], v));
_mm_store_ps(&d[n+8], _mm_mul_ps(t[2], v));
_mm_store_ps(&d[n+12], _mm_mul_ps(t[3], v));
}
for(; n < n_samples; n++)
_mm_store_ss(&d[n], _mm_mul_ss(_mm_load_ss(&s[n]), v));
}
}
void channelmix_copy_sse(struct channelmix *mix, void * SPA_RESTRICT dst[],
const void * SPA_RESTRICT src[], uint32_t n_samples)
{
uint32_t i, n, unrolled, n_dst = mix->dst_chan;
uint32_t i, n_dst = mix->dst_chan;
float **d = (float **)dst;
const float **s = (const float **)src;
for (i = 0; i < n_dst; i++)
vol_sse(d[i], s[i], mix->matrix[i][i], n_samples);
}
if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
for (i = 0; i < n_dst; i++)
memset(d[i], 0, n_samples * sizeof(float));
}
else if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_IDENTITY)) {
for (i = 0; i < n_dst; i++)
spa_memcpy(d[i], s[i], n_samples * sizeof(float));
/* FL+FR+FC+LFE -> FL+FR */
void
channelmix_f32_3p1_2_sse(struct channelmix *mix, void * SPA_RESTRICT dst[],
const void * SPA_RESTRICT src[], uint32_t n_samples)
{
float **d = (float **) dst;
const float **s = (const float **) src;
const float m0 = mix->matrix[0][0];
const float m1 = mix->matrix[1][1];
const float m2 = (mix->matrix[0][2] + mix->matrix[1][2]) * 0.5f;
const float m3 = (mix->matrix[0][3] + mix->matrix[1][3]) * 0.5f;
if (m0 == 0.0f && m1 == 0.0f && m2 == 0.0f && m3 == 0.0f) {
clear_sse(d[0], n_samples);
clear_sse(d[1], n_samples);
}
else {
for (i = 0; i < n_dst; i++) {
float *di = d[i];
const float *si = s[i];
__m128 t[4];
const __m128 vol = _mm_set1_ps(mix->matrix[i][i]);
uint32_t n, unrolled;
const __m128 v0 = _mm_set1_ps(m0);
const __m128 v1 = _mm_set1_ps(m1);
const __m128 clev = _mm_set1_ps(m2);
const __m128 llev = _mm_set1_ps(m3);
__m128 ctr;
if (SPA_IS_ALIGNED(di, 16) &&
SPA_IS_ALIGNED(si, 16))
unrolled = n_samples & ~15;
else
unrolled = 0;
if (SPA_IS_ALIGNED(s[0], 16) &&
SPA_IS_ALIGNED(s[1], 16) &&
SPA_IS_ALIGNED(s[2], 16) &&
SPA_IS_ALIGNED(s[3], 16) &&
SPA_IS_ALIGNED(d[0], 16) &&
SPA_IS_ALIGNED(d[1], 16))
unrolled = n_samples & ~3;
else
unrolled = 0;
for(n = 0; n < unrolled; n += 16) {
t[0] = _mm_load_ps(&si[n]);
t[1] = _mm_load_ps(&si[n+4]);
t[2] = _mm_load_ps(&si[n+8]);
t[3] = _mm_load_ps(&si[n+12]);
_mm_store_ps(&di[n], _mm_mul_ps(t[0], vol));
_mm_store_ps(&di[n+4], _mm_mul_ps(t[1], vol));
_mm_store_ps(&di[n+8], _mm_mul_ps(t[2], vol));
_mm_store_ps(&di[n+12], _mm_mul_ps(t[3], vol));
}
for(; n < n_samples; n++)
_mm_store_ss(&di[n], _mm_mul_ss(_mm_load_ss(&si[n]), vol));
for(n = 0; n < unrolled; n += 4) {
ctr = _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&s[2][n]), clev),
_mm_mul_ps(_mm_load_ps(&s[3][n]), llev));
_mm_store_ps(&d[0][n], _mm_add_ps(_mm_mul_ps(_mm_load_ps(&s[0][n]), v0), ctr));
_mm_store_ps(&d[1][n], _mm_add_ps(_mm_mul_ps(_mm_load_ps(&s[1][n]), v1), ctr));
}
for(; n < n_samples; n++) {
ctr = _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s[2][n]), clev),
_mm_mul_ss(_mm_load_ss(&s[3][n]), llev));
_mm_store_ss(&d[0][n], _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s[0][n]), v0), ctr));
_mm_store_ss(&d[1][n], _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s[1][n]), v1), ctr));
}
}
}
@ -85,77 +143,49 @@ channelmix_f32_5p1_2_sse(struct channelmix *mix, void * SPA_RESTRICT dst[],
const __m128 slev0 = _mm_set1_ps(mix->matrix[0][4]);
const __m128 slev1 = _mm_set1_ps(mix->matrix[1][5]);
__m128 in, ctr;
const float *sFL = s[0], *sFR = s[1], *sFC = s[2], *sLFE = s[3], *sSL = s[4], *sSR = s[5];
float *dFL = d[0], *dFR = d[1];
if (SPA_IS_ALIGNED(sFL, 16) &&
SPA_IS_ALIGNED(sFR, 16) &&
SPA_IS_ALIGNED(sFC, 16) &&
SPA_IS_ALIGNED(sLFE, 16) &&
SPA_IS_ALIGNED(sSL, 16) &&
SPA_IS_ALIGNED(sSR, 16) &&
SPA_IS_ALIGNED(dFL, 16) &&
SPA_IS_ALIGNED(dFR, 16))
if (SPA_IS_ALIGNED(s[0], 16) &&
SPA_IS_ALIGNED(s[1], 16) &&
SPA_IS_ALIGNED(s[2], 16) &&
SPA_IS_ALIGNED(s[3], 16) &&
SPA_IS_ALIGNED(s[4], 16) &&
SPA_IS_ALIGNED(s[5], 16) &&
SPA_IS_ALIGNED(d[0], 16) &&
SPA_IS_ALIGNED(d[1], 16))
unrolled = n_samples & ~3;
else
unrolled = 0;
if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
memset(dFL, 0, n_samples * sizeof(float));
memset(dFR, 0, n_samples * sizeof(float));
}
else if (m00 == 1.0f && m11 == 1.0f) {
for(n = 0; n < unrolled; n += 4) {
ctr = _mm_mul_ps(_mm_load_ps(&sFC[n]), clev);
ctr = _mm_add_ps(ctr, _mm_mul_ps(_mm_load_ps(&sLFE[n]), llev));
in = _mm_mul_ps(_mm_load_ps(&sSL[n]), slev0);
in = _mm_add_ps(in, ctr);
in = _mm_add_ps(in, _mm_load_ps(&sFL[n]));
_mm_store_ps(&dFL[n], in);
in = _mm_mul_ps(_mm_load_ps(&sSR[n]), slev1);
in = _mm_add_ps(in, ctr);
in = _mm_add_ps(in, _mm_load_ps(&sFR[n]));
_mm_store_ps(&dFR[n], in);
}
for(; n < n_samples; n++) {
ctr = _mm_mul_ss(_mm_load_ss(&sFC[n]), clev);
ctr = _mm_add_ss(ctr, _mm_mul_ss(_mm_load_ss(&sLFE[n]), llev));
in = _mm_mul_ss(_mm_load_ss(&sSL[n]), slev0);
in = _mm_add_ss(in, ctr);
in = _mm_add_ss(in, _mm_load_ss(&sFL[n]));
_mm_store_ss(&dFL[n], in);
in = _mm_mul_ss(_mm_load_ss(&sSR[n]), slev1);
in = _mm_add_ss(in, ctr);
in = _mm_add_ss(in, _mm_load_ss(&sFR[n]));
_mm_store_ss(&dFR[n], in);
}
clear_sse(d[0], n_samples);
clear_sse(d[1], n_samples);
}
else {
const __m128 v0 = _mm_set1_ps(m00);
const __m128 v1 = _mm_set1_ps(m11);
for(n = 0; n < unrolled; n += 4) {
ctr = _mm_mul_ps(_mm_load_ps(&sFC[n]), clev);
ctr = _mm_add_ps(ctr, _mm_mul_ps(_mm_load_ps(&sLFE[n]), llev));
in = _mm_mul_ps(_mm_load_ps(&sSL[n]), slev0);
ctr = _mm_add_ps(_mm_mul_ps(_mm_load_ps(&s[2][n]), clev),
_mm_mul_ps(_mm_load_ps(&s[3][n]), llev));
in = _mm_mul_ps(_mm_load_ps(&s[4][n]), slev0);
in = _mm_add_ps(in, ctr);
in = _mm_add_ps(in, _mm_mul_ps(_mm_load_ps(&sFL[n]), v0));
_mm_store_ps(&dFL[n], in);
in = _mm_mul_ps(_mm_load_ps(&sSR[n]), slev1);
in = _mm_add_ps(in, _mm_mul_ps(_mm_load_ps(&s[0][n]), v0));
_mm_store_ps(&d[0][n], in);
in = _mm_mul_ps(_mm_load_ps(&s[5][n]), slev1);
in = _mm_add_ps(in, ctr);
in = _mm_add_ps(in, _mm_mul_ps(_mm_load_ps(&sFR[n]), v1));
_mm_store_ps(&dFR[n], in);
in = _mm_add_ps(in, _mm_mul_ps(_mm_load_ps(&s[1][n]), v1));
_mm_store_ps(&d[1][n], in);
}
for(; n < n_samples; n++) {
ctr = _mm_mul_ss(_mm_load_ss(&sFC[n]), clev);
ctr = _mm_add_ss(ctr, _mm_mul_ss(_mm_load_ss(&sLFE[n]), llev));
in = _mm_mul_ss(_mm_load_ss(&sSL[n]), slev0);
ctr = _mm_mul_ss(_mm_load_ss(&s[2][n]), clev);
ctr = _mm_add_ss(ctr, _mm_mul_ss(_mm_load_ss(&s[3][n]), llev));
in = _mm_mul_ss(_mm_load_ss(&s[4][n]), slev0);
in = _mm_add_ss(in, ctr);
in = _mm_add_ss(in, _mm_mul_ss(_mm_load_ss(&sFL[n]), v0));
_mm_store_ss(&dFL[n], in);
in = _mm_mul_ss(_mm_load_ss(&sSR[n]), slev1);
in = _mm_add_ss(in, _mm_mul_ss(_mm_load_ss(&s[0][n]), v0));
_mm_store_ss(&d[0][n], in);
in = _mm_mul_ss(_mm_load_ss(&s[5][n]), slev1);
in = _mm_add_ss(in, ctr);
in = _mm_add_ss(in, _mm_mul_ss(_mm_load_ss(&sFR[n]), v1));
_mm_store_ss(&dFR[n], in);
in = _mm_add_ss(in, _mm_mul_ss(_mm_load_ss(&s[1][n]), v1));
_mm_store_ss(&d[1][n], in);
}
}
}
@ -168,73 +198,51 @@ channelmix_f32_5p1_3p1_sse(struct channelmix *mix, void * SPA_RESTRICT dst[],
uint32_t i, n, unrolled, n_dst = mix->dst_chan;
float **d = (float **) dst;
const float **s = (const float **) src;
const __m128 v0 = _mm_set1_ps(mix->matrix[0][0]);
const __m128 v1 = _mm_set1_ps(mix->matrix[1][1]);
const __m128 slev0 = _mm_set1_ps(mix->matrix[0][4]);
const __m128 slev1 = _mm_set1_ps(mix->matrix[1][5]);
const __m128 v2 = _mm_set1_ps(mix->matrix[2][2]);
const __m128 v3 = _mm_set1_ps(mix->matrix[3][3]);
__m128 avg[2];
const float *sFL = s[0], *sFR = s[1], *sFC = s[2], *sLFE = s[3], *sSL = s[4], *sSR = s[5];
float *dFL = d[0], *dFR = d[1], *dFC = d[2], *dLFE = d[3];
if (SPA_IS_ALIGNED(sFL, 16) &&
SPA_IS_ALIGNED(sFR, 16) &&
SPA_IS_ALIGNED(sFC, 16) &&
SPA_IS_ALIGNED(sLFE, 16) &&
SPA_IS_ALIGNED(sSL, 16) &&
SPA_IS_ALIGNED(sSR, 16) &&
SPA_IS_ALIGNED(dFL, 16) &&
SPA_IS_ALIGNED(dFR, 16) &&
SPA_IS_ALIGNED(dFC, 16) &&
SPA_IS_ALIGNED(dLFE, 16))
unrolled = n_samples & ~7;
if (SPA_IS_ALIGNED(s[0], 16) &&
SPA_IS_ALIGNED(s[1], 16) &&
SPA_IS_ALIGNED(s[2], 16) &&
SPA_IS_ALIGNED(s[3], 16) &&
SPA_IS_ALIGNED(s[4], 16) &&
SPA_IS_ALIGNED(s[5], 16) &&
SPA_IS_ALIGNED(d[0], 16) &&
SPA_IS_ALIGNED(d[1], 16) &&
SPA_IS_ALIGNED(d[2], 16) &&
SPA_IS_ALIGNED(d[3], 16))
unrolled = n_samples & ~3;
else
unrolled = 0;
if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
for (i = 0; i < n_dst; i++)
memset(d[i], 0, n_samples * sizeof(float));
clear_sse(d[i], n_samples);
}
else {
for(n = 0; n < unrolled; n += 8) {
avg[0] = _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&sFL[n]), v0),
_mm_mul_ps(_mm_load_ps(&sSL[n]), slev0));
avg[1] = _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&sFL[n+4]), v0),
_mm_mul_ps(_mm_load_ps(&sSL[n+4]), slev0));
_mm_store_ps(&dFL[n], avg[0]);
_mm_store_ps(&dFL[n+4], avg[1]);
const __m128 v0 = _mm_set1_ps(mix->matrix[0][0]);
const __m128 v1 = _mm_set1_ps(mix->matrix[1][1]);
const __m128 slev0 = _mm_set1_ps(mix->matrix[0][4]);
const __m128 slev1 = _mm_set1_ps(mix->matrix[1][5]);
avg[0] = _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&sFR[n]), v1),
_mm_mul_ps(_mm_load_ps(&sSR[n]), slev1));
avg[1] = _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&sFR[n+4]), v1),
_mm_mul_ps(_mm_load_ps(&sSR[n+4]), slev1));
_mm_store_ps(&dFR[n], avg[0]);
_mm_store_ps(&dFR[n+4], avg[1]);
for(n = 0; n < unrolled; n += 4) {
_mm_store_ps(&d[0][n], _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&s[0][n]), v0),
_mm_mul_ps(_mm_load_ps(&s[4][n]), slev0)));
_mm_store_ps(&dFC[n], _mm_mul_ps(_mm_load_ps(&sFC[n]), v2));
_mm_store_ps(&dFC[n+4], _mm_mul_ps(_mm_load_ps(&sFC[n+4]), v2));
_mm_store_ps(&dLFE[n], _mm_mul_ps(_mm_load_ps(&sLFE[n]), v3));
_mm_store_ps(&dLFE[n+4], _mm_mul_ps(_mm_load_ps(&sLFE[n+4]), v3));
_mm_store_ps(&d[1][n], _mm_add_ps(
_mm_mul_ps(_mm_load_ps(&s[1][n]), v1),
_mm_mul_ps(_mm_load_ps(&s[5][n]), slev1)));
}
for(; n < n_samples; n++) {
avg[0] = _mm_add_ss(
_mm_mul_ss(_mm_load_ss(&sFL[n]), v0),
_mm_mul_ss(_mm_load_ss(&sSL[n]), slev0));
_mm_store_ss(&dFL[n], avg[0]);
_mm_store_ss(&d[0][n], _mm_add_ss(
_mm_mul_ss(_mm_load_ss(&s[0][n]), v0),
_mm_mul_ss(_mm_load_ss(&s[4][n]), slev0)));
avg[0] = _mm_add_ss(
_mm_mul_ss(_mm_load_ss(&sFR[n]), v1),
_mm_mul_ss(_mm_load_ss(&sSR[n]), slev1));
_mm_store_ss(&dFR[n], avg[0]);
_mm_store_ss(&dFC[n], _mm_mul_ss(_mm_load_ss(&sFC[n]), v2));
_mm_store_ss(&dLFE[n], _mm_mul_ss(_mm_load_ss(&sLFE[n]), v3));
_mm_store_ss(&d[1][n], _mm_add_ss(
_mm_mul_ss(_mm_load_ss(&s[1][n]), v1),
_mm_mul_ss(_mm_load_ss(&s[5][n]), slev1)));
}
vol_sse(d[2], s[2], mix->matrix[2][2], n_samples);
vol_sse(d[3], s[3], mix->matrix[3][3], n_samples);
}
}
@ -243,76 +251,20 @@ void
channelmix_f32_5p1_4_sse(struct channelmix *mix, void * SPA_RESTRICT dst[],
const void * SPA_RESTRICT src[], uint32_t n_samples)
{
uint32_t i, n, unrolled, n_dst = mix->dst_chan;
uint32_t i, n_dst = mix->dst_chan;
float **d = (float **) dst;
const float **s = (const float **) src;
const __m128 clev = _mm_set1_ps(mix->matrix[0][2]);
const __m128 llev = _mm_set1_ps(mix->matrix[0][3]);
const float m00 = mix->matrix[0][0];
const float m11 = mix->matrix[1][1];
const float m24 = mix->matrix[2][4];
const float m35 = mix->matrix[3][5];
__m128 ctr;
const float *sFL = s[0], *sFR = s[1], *sFC = s[2], *sLFE = s[3], *sSL = s[4], *sSR = s[5];
float *dFL = d[0], *dFR = d[1], *dRL = d[2], *dRR = d[3];
if (SPA_IS_ALIGNED(sFL, 16) &&
SPA_IS_ALIGNED(sFR, 16) &&
SPA_IS_ALIGNED(sFC, 16) &&
SPA_IS_ALIGNED(sLFE, 16) &&
SPA_IS_ALIGNED(sSL, 16) &&
SPA_IS_ALIGNED(sSR, 16) &&
SPA_IS_ALIGNED(dFL, 16) &&
SPA_IS_ALIGNED(dFR, 16) &&
SPA_IS_ALIGNED(dRL, 16) &&
SPA_IS_ALIGNED(dRR, 16))
unrolled = n_samples & ~3;
else
unrolled = 0;
const float v4 = mix->matrix[2][4];
const float v5 = mix->matrix[3][5];
if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
for (i = 0; i < n_dst; i++)
memset(d[i], 0, n_samples * sizeof(float));
}
else if (m00 == 1.0f && m11 == 1.0f && m24 == 1.0f && m35 == 1.0f) {
for(n = 0; n < unrolled; n += 4) {
ctr = _mm_mul_ps(_mm_load_ps(&sFC[n]), clev);
ctr = _mm_add_ps(ctr, _mm_mul_ps(_mm_load_ps(&sLFE[n]), llev));
_mm_store_ps(&dFL[n], _mm_add_ps(_mm_load_ps(&sFL[n]), ctr));
_mm_store_ps(&dFR[n], _mm_add_ps(_mm_load_ps(&sFR[n]), ctr));
_mm_store_ps(&dRL[n], _mm_load_ps(&sSL[n]));
_mm_store_ps(&dRR[n], _mm_load_ps(&sSR[n]));
}
for(; n < n_samples; n++) {
ctr = _mm_mul_ss(_mm_load_ss(&sFC[n]), clev);
ctr = _mm_add_ss(ctr, _mm_mul_ss(_mm_load_ss(&sLFE[n]), llev));
_mm_store_ss(&dFL[n], _mm_add_ss(_mm_load_ss(&sFL[n]), ctr));
_mm_store_ss(&dFR[n], _mm_add_ss(_mm_load_ss(&sFR[n]), ctr));
_mm_store_ss(&dRL[n], _mm_load_ss(&sSL[n]));
_mm_store_ss(&dRR[n], _mm_load_ss(&sSR[n]));
}
clear_sse(d[i], n_samples);
}
else {
const __m128 v0 = _mm_set1_ps(m00);
const __m128 v1 = _mm_set1_ps(m11);
const __m128 v4 = _mm_set1_ps(m24);
const __m128 v5 = _mm_set1_ps(m35);
channelmix_f32_3p1_2_sse(mix, dst, src, n_samples);
for(n = 0; n < unrolled; n += 4) {
ctr = _mm_mul_ps(_mm_load_ps(&sFC[n]), clev);
ctr = _mm_add_ps(ctr, _mm_mul_ps(_mm_load_ps(&sLFE[n]), llev));
_mm_store_ps(&dFL[n], _mm_mul_ps(_mm_add_ps(_mm_load_ps(&sFL[n]), ctr), v0));
_mm_store_ps(&dFR[n], _mm_mul_ps(_mm_add_ps(_mm_load_ps(&sFR[n]), ctr), v1));
_mm_store_ps(&dRL[n], _mm_mul_ps(_mm_load_ps(&sSL[n]), v4));
_mm_store_ps(&dRR[n], _mm_mul_ps(_mm_load_ps(&sSR[n]), v5));
}
for(; n < n_samples; n++) {
ctr = _mm_mul_ss(_mm_load_ss(&sFC[n]), clev);
ctr = _mm_add_ss(ctr, _mm_mul_ss(_mm_load_ss(&sLFE[n]), llev));
_mm_store_ss(&dFL[n], _mm_mul_ss(_mm_add_ss(_mm_load_ss(&sFL[n]), ctr), v0));
_mm_store_ss(&dFR[n], _mm_mul_ss(_mm_add_ss(_mm_load_ss(&sFR[n]), ctr), v1));
_mm_store_ss(&dRL[n], _mm_mul_ss(_mm_load_ss(&sSL[n]), v4));
_mm_store_ss(&dRR[n], _mm_mul_ss(_mm_load_ss(&sSR[n]), v5));
}
vol_sse(d[2], s[4], v4, n_samples);
vol_sse(d[3], s[5], v5, n_samples);
}
}

View file

@ -83,6 +83,10 @@ static const struct channelmix_info {
{ 2, MASK_STEREO, 4, MASK_3_1, channelmix_f32_2_3p1_c, 0, "f32_2_3p1_c" },
{ 2, MASK_STEREO, 6, MASK_5_1, channelmix_f32_2_5p1_c, 0, "f32_2_5p1_c" },
{ 2, MASK_STEREO, 8, MASK_7_1, channelmix_f32_2_7p1_c, 0, "f32_2_7p1_c" },
#if defined (HAVE_SSE)
{ 4, MASK_3_1, 2, MASK_STEREO, channelmix_f32_3p1_2_sse, 0, "f32_3p1_2_sse" },
#endif
{ 4, MASK_3_1, 2, MASK_STEREO, channelmix_f32_3p1_2_c, 0, "f32_3p1_2_c" },
#if defined (HAVE_SSE)
{ 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_sse, SPA_CPU_FLAG_SSE, "f32_5p1_2_sse" },
#endif

View file

@ -142,6 +142,7 @@ DEFINE_FUNCTION(f32_2_4, c);
DEFINE_FUNCTION(f32_2_3p1, c);
DEFINE_FUNCTION(f32_2_5p1, c);
DEFINE_FUNCTION(f32_2_7p1, c);
DEFINE_FUNCTION(f32_3p1_2, c);
DEFINE_FUNCTION(f32_5p1_2, c);
DEFINE_FUNCTION(f32_5p1_3p1, c);
DEFINE_FUNCTION(f32_5p1_4, c);
@ -151,6 +152,7 @@ DEFINE_FUNCTION(f32_7p1_4, c);
#if defined (HAVE_SSE)
DEFINE_FUNCTION(copy, sse);
DEFINE_FUNCTION(f32_3p1_2, sse);
DEFINE_FUNCTION(f32_5p1_2, sse);
DEFINE_FUNCTION(f32_5p1_3p1, sse);
DEFINE_FUNCTION(f32_5p1_4, sse);