Commit fd5e1d13 authored by Clément Bœsch's avatar Clément Bœsch

Merge commit 'a9ba5959'

* commit 'a9ba5959':
  ac3dsp: Add some special-case handling for the C downmix function
Merged-by: 's avatarClément Bœsch <u@pkh.me>
parents e39d4ff1 a9ba5959
......@@ -216,9 +216,46 @@ static void ac3_sum_square_butterfly_float_c(float sum[4],
static void ac3_downmix_c(float **samples, float **matrix,
int out_ch, int in_ch, int len)
{
int **matrix_cmp = (int **)matrix;
int i, j;
float v0, v1;
if (out_ch == 2) {
if (in_ch == 5 && out_ch == 2 &&
!(matrix_cmp[1][0] | matrix_cmp[0][2] |
matrix_cmp[1][3] | matrix_cmp[0][4] |
(matrix_cmp[0][1] ^ matrix_cmp[1][1]) |
(matrix_cmp[0][0] ^ matrix_cmp[1][2]))) {
float front_mix = matrix[0][0];
float center_mix = matrix[0][1];
float surround_mix = matrix[0][3];
for (i = 0; i < len; i++) {
v0 = samples[0][i] * front_mix +
samples[1][i] * center_mix +
samples[3][i] * surround_mix;
v1 = samples[1][i] * center_mix +
samples[2][i] * front_mix +
samples[4][i] * surround_mix;
samples[0][i] = v0;
samples[1][i] = v1;
}
} else if (in_ch == 5 && out_ch == 1 &&
matrix_cmp[0][0] == matrix_cmp[0][2] &&
matrix_cmp[0][3] == matrix_cmp[0][4]) {
float front_mix = matrix[0][0];
float center_mix = matrix[0][1];
float surround_mix = matrix[0][3];
for (i = 0; i < len; i++) {
samples[0][i] = samples[0][i] * front_mix +
samples[1][i] * center_mix +
samples[2][i] * front_mix +
samples[3][i] * surround_mix +
samples[4][i] * surround_mix;
}
} else if (out_ch == 2) {
for (i = 0; i < len; i++) {
v0 = v1 = 0.0f;
for (j = 0; j < in_ch; j++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment