mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
channelmix: apply channel volumes correctly
This commit is contained in:
parent
449d98910b
commit
87ae7a8011
5 changed files with 270 additions and 253 deletions
|
|
@ -31,24 +31,20 @@ channelmix_copy_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT ds
|
|||
uint32_t i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
const float *m = mix->matrix;
|
||||
const float v = mix->volume;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
else if (mix->identity) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
spa_memcpy(d[i], s[i], n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < n_dst; i++) {
|
||||
const float vol = m[i * n_src + i];
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[i][n] = s[i][n] * vol;
|
||||
d[i][n] = s[i][n] * mix->matrix[i][i];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,13 +57,12 @@ channelmix_f32_n_m_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT
|
|||
uint32_t i, j, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = mix->matrix;
|
||||
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
for (i = 0; i < n_dst; i++) {
|
||||
float sum = 0.0f;
|
||||
for (j = 0; j < n_src; j++)
|
||||
sum += s[j][n] * m[i * n_src + j];
|
||||
sum += s[j][n] * mix->matrix[i][j];
|
||||
d[i][n] = sum;
|
||||
}
|
||||
}
|
||||
|
|
@ -83,19 +78,26 @@ channelmix_f32_1_2_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT
|
|||
uint32_t n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][0];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
memset(d[1], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
else if (mix->norm) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = d[1][n] = s[0][n];
|
||||
}
|
||||
else {
|
||||
else if (mix->equal) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = d[1][n] = s[0][n] * v;
|
||||
d[0][n] = d[1][n] = s[0][n] * v0;
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = s[0][n] * v0;
|
||||
d[1][n] = s[0][n] * v1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,15 +108,19 @@ channelmix_f32_2_1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT
|
|||
uint32_t n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[0][1];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
else if (mix->equal) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n]) * f;
|
||||
d[0][n] = (s[0][n] + s[1][n]) * v0;
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = s[0][n] * v0 + s[1][n] * v1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,15 +131,22 @@ channelmix_f32_4_1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT
|
|||
uint32_t n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[0][1];
|
||||
const float v2 = mix->matrix[0][2];
|
||||
const float v3 = mix->matrix[0][3];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.25f;
|
||||
else if (mix->equal) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n] + s[3][n]) * f;
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n] + s[3][n]) * v0;
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = s[0][n] * v0 + s[1][n] * v1 +
|
||||
s[2][n] * v2 + s[3][n] * v3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,15 +157,20 @@ channelmix_f32_3p1_1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[0][1];
|
||||
const float v2 = mix->matrix[0][2];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
else if (mix->equal) {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n]) * f;
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n] + s[3][n]) * v0;
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = s[0][n] * v0 + s[1][n] * v1 + s[2][n] * v2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -166,22 +184,33 @@ channelmix_f32_2_4_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRICT
|
|||
uint32_t i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
const float v2 = mix->matrix[2][0];
|
||||
const float v3 = mix->matrix[3][1];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
else if (mix->norm) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = d[2][n] = s[0][n];
|
||||
d[1][n] = d[3][n] = s[1][n];
|
||||
}
|
||||
}
|
||||
else if (v0 == v2 && v1 == v3) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = d[2][n] = s[0][n] * v0;
|
||||
d[1][n] = d[3][n] = s[1][n] * v1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = d[2][n] = s[0][n] * v;
|
||||
d[1][n] = d[3][n] = s[1][n] * v;
|
||||
d[0][n] = s[0][n] * v0;
|
||||
d[1][n] = s[1][n] * v1;
|
||||
d[2][n] = s[0][n] * v2;
|
||||
d[3][n] = s[1][n] * v3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -194,13 +223,14 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
else if (mix->norm) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = s[0][n];
|
||||
d[1][n] = s[1][n];
|
||||
|
|
@ -209,11 +239,10 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
}
|
||||
}
|
||||
else {
|
||||
const float f = 0.5f * v;
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = s[0][n] * v;
|
||||
d[1][n] = s[1][n] * v;
|
||||
d[2][n] = (s[0][n] + s[1][n]) * f;
|
||||
d[0][n] = s[0][n] * v0;
|
||||
d[1][n] = s[1][n] * v1;
|
||||
d[2][n] = (d[0][n] + d[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -227,13 +256,16 @@ channelmix_f32_2_5p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
const float v4 = mix->matrix[4][0];
|
||||
const float v5 = mix->matrix[5][1];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
else if (mix->norm) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = d[4][n] = s[0][n];
|
||||
d[1][n] = d[5][n] = s[1][n];
|
||||
|
|
@ -242,12 +274,13 @@ channelmix_f32_2_5p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
}
|
||||
}
|
||||
else {
|
||||
const float f = 0.5f * v;
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = d[4][n] = s[0][n] * v;
|
||||
d[1][n] = d[5][n] = s[1][n] * v;
|
||||
d[2][n] = (s[0][n] + s[1][n]) * f;
|
||||
d[0][n] = s[0][n] * v0;
|
||||
d[1][n] = s[1][n] * v1;
|
||||
d[2][n] = (d[0][n] + d[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
d[4][n] = s[0][n] * v4;
|
||||
d[5][n] = s[1][n] * v5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -260,28 +293,22 @@ channelmix_f32_5p1_2_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = mix->matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
const float clev = mix->matrix[2][0];
|
||||
const float llev = mix->matrix[3][0];
|
||||
const float slev0 = mix->matrix[4][0];
|
||||
const float slev1 = mix->matrix[4][1];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
memset(d[1], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
const float ctr = clev * s[2][n] + llev * s[3][n];
|
||||
d[0][n] = s[0][n] + ctr + (slev * s[4][n]);
|
||||
d[1][n] = s[1][n] + ctr + (slev * s[5][n]);
|
||||
}
|
||||
}
|
||||
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] + ctr + (slev * s[4][n])) * v;
|
||||
d[1][n] = (s[1][n] + ctr + (slev * s[5][n])) * v;
|
||||
d[0][n] = s[0][n] * v0 + ctr + (slev0 * s[4][n]);
|
||||
d[1][n] = s[1][n] * v1 + ctr + (slev1 * s[5][n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -294,19 +321,23 @@ channelmix_f32_5p1_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_REST
|
|||
uint32_t i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
const float v2 = mix->matrix[2][2];
|
||||
const float v3 = mix->matrix[3][3];
|
||||
const float v4 = mix->matrix[0][4];
|
||||
const float v5 = mix->matrix[1][5];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f1 = 0.5f * v;
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = (s[0][n] + s[4][n]) * f1;
|
||||
d[1][n] = (s[1][n] + s[5][n]) * f1;
|
||||
d[2][n] = s[2][n] * v;
|
||||
d[3][n] = s[3][n] * v;
|
||||
d[0][n] = s[0][n] * v0 + s[4][n] * v4;
|
||||
d[1][n] = s[1][n] * v1 + s[5][n] * v5;
|
||||
d[2][n] = s[2][n] * v2;
|
||||
d[3][n] = s[3][n] * v3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -319,31 +350,24 @@ channelmix_f32_5p1_4_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = mix->matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
float v = mix->volume;
|
||||
const float clev = mix->matrix[2][0];
|
||||
const float llev = mix->matrix[3][0];
|
||||
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];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
const float ctr = s[2][n] * clev + s[3][n] * llev;
|
||||
d[0][n] = s[0][n] + ctr;
|
||||
d[1][n] = s[1][n] + ctr;
|
||||
d[2][n] = s[4][n];
|
||||
d[3][n] = s[5][n];
|
||||
}
|
||||
}
|
||||
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] + ctr) * v;
|
||||
d[1][n] = (s[1][n] + ctr) * v;
|
||||
d[2][n] = s[4][n] * v;
|
||||
d[3][n] = s[5][n] * v;
|
||||
d[0][n] = s[0][n] * v0 + ctr;
|
||||
d[1][n] = s[1][n] * v1 + ctr;
|
||||
d[2][n] = s[4][n] * v4;
|
||||
d[3][n] = s[5][n] * v5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -358,28 +382,24 @@ channelmix_f32_7p1_2_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = mix->matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
float v = mix->volume;
|
||||
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;
|
||||
const float slev0 = mix->matrix[0][4];
|
||||
const float slev1 = mix->matrix[1][5];
|
||||
const float rlev0 = mix->matrix[0][6];
|
||||
const float rlev1 = mix->matrix[1][7];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
memset(d[1], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
const float ctr = clev * s[2][n] + llev * s[3][n];
|
||||
d[0][n] = s[0][n] + ctr + (slev * (s[4][n] + s[6][n]));
|
||||
d[1][n] = s[1][n] + ctr + (slev * (s[5][n] + s[7][n]));
|
||||
}
|
||||
}
|
||||
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] + ctr + (slev * (s[4][n] + s[6][n]))) * v;
|
||||
d[1][n] = (s[1][n] + ctr + (slev * (s[5][n] + s[6][n]))) * v;
|
||||
d[0][n] = s[0][n] * v0 + ctr + s[4][n] * slev0 + s[6][n] * rlev0;
|
||||
d[1][n] = s[1][n] * v1 + ctr + s[5][n] * slev1 + s[6][n] * rlev1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -392,19 +412,23 @@ channelmix_f32_7p1_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_REST
|
|||
uint32_t i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
float v = mix->volume;
|
||||
const float v0 = mix->matrix[0][0];
|
||||
const float v1 = mix->matrix[1][1];
|
||||
const float v2 = mix->matrix[2][2];
|
||||
const float v3 = mix->matrix[3][3];
|
||||
const float v4 = (mix->matrix[0][4] + mix->matrix[0][6]) * 0.5f;
|
||||
const float v5 = (mix->matrix[1][5] + mix->matrix[1][6]) * 0.5f;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f1 = 0.5 * v;
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
d[0][n] = s[0][n] + (s[4][n] + s[6][n]) * f1;
|
||||
d[1][n] = s[1][n] + (s[5][n] + s[7][n]) * f1;
|
||||
d[2][n] = s[2][n] * v;
|
||||
d[3][n] = s[3][n] * v;
|
||||
d[0][n] = s[0][n] * v0 + (s[4][n] + s[6][n]) * v4;
|
||||
d[1][n] = s[1][n] * v1 + (s[5][n] + s[7][n]) * v5;
|
||||
d[2][n] = s[2][n] * v2;
|
||||
d[3][n] = s[3][n] * v3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -417,36 +441,28 @@ channelmix_f32_7p1_4_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
|
|||
uint32_t i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = mix->matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
float v = mix->volume;
|
||||
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;
|
||||
const float slev0 = mix->matrix[0][4];
|
||||
const float slev1 = mix->matrix[1][5];
|
||||
const float rlev0 = mix->matrix[0][6];
|
||||
const float rlev1 = mix->matrix[1][7];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
if (mix->zero) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
const float ctr = s[2][n] * clev + s[3][n] * llev;
|
||||
const float sl = s[4][n] * slev;
|
||||
const float sr = s[5][n] * slev;
|
||||
d[0][n] = s[0][n] + ctr + sl;
|
||||
d[1][n] = s[1][n] + ctr + sr;
|
||||
d[2][n] = s[6][n] + sl;
|
||||
d[3][n] = s[7][n] + sr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++) {
|
||||
const float ctr = s[2][n] * clev + s[3][n] * llev;
|
||||
const float sl = s[4][n] * slev;
|
||||
const float sr = s[5][n] * slev;
|
||||
d[0][n] = (s[0][n] + ctr + sl) * v;
|
||||
d[1][n] = (s[1][n] + ctr + sr) * v;
|
||||
d[2][n] = (s[6][n] + sl) * v;
|
||||
d[3][n] = (s[7][n] + sr) * v;
|
||||
const float sl = s[4][n] * slev0;
|
||||
const float sr = s[5][n] * slev1;
|
||||
d[0][n] = s[0][n] * v0 + ctr + sl;
|
||||
d[1][n] = s[1][n] * v1 + ctr + sr;
|
||||
d[2][n] = s[6][n] * rlev0 + sl;
|
||||
d[3][n] = s[7][n] * rlev1 + sr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue