mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
audioconvert: compile c version separately
Also compile the c versions in a separate module with their own flags.
This commit is contained in:
parent
fe6ebd0e8a
commit
d260cb19be
14 changed files with 1471 additions and 1255 deletions
|
|
@ -105,34 +105,34 @@ static void run_test(const char *name, const char *impl, bool in_packed, bool ou
|
|||
|
||||
static void test_f32_u8(void)
|
||||
{
|
||||
run_test("test_f32_u8", "c", true, true, conv_f32_to_u8);
|
||||
run_test("test_f32d_u8", "c", false, true, conv_f32d_to_u8);
|
||||
run_test("test_f32_u8d", "c", true, false, conv_f32_to_u8d);
|
||||
run_test("test_f32d_u8d", "c", false, false, conv_f32d_to_u8d);
|
||||
run_test("test_f32_u8", "c", true, true, conv_f32_to_u8_c);
|
||||
run_test("test_f32d_u8", "c", false, true, conv_f32d_to_u8_c);
|
||||
run_test("test_f32_u8d", "c", true, false, conv_f32_to_u8d_c);
|
||||
run_test("test_f32d_u8d", "c", false, false, conv_f32d_to_u8d_c);
|
||||
}
|
||||
|
||||
static void test_u8_f32(void)
|
||||
{
|
||||
run_test("test_u8_f32", "c", true, true, conv_u8_to_f32);
|
||||
run_test("test_u8d_f32", "c", false, true, conv_u8d_to_f32);
|
||||
run_test("test_u8_f32d", "c", true, false, conv_u8_to_f32d);
|
||||
run_test("test_u8_f32", "c", true, true, conv_u8_to_f32_c);
|
||||
run_test("test_u8d_f32", "c", false, true, conv_u8d_to_f32_c);
|
||||
run_test("test_u8_f32d", "c", true, false, conv_u8_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s16(void)
|
||||
{
|
||||
run_test("test_f32_s16", "c", true, true, conv_f32_to_s16);
|
||||
run_test("test_f32d_s16", "c", false, true, conv_f32d_to_s16);
|
||||
run_test("test_f32_s16", "c", true, true, conv_f32_to_s16_c);
|
||||
run_test("test_f32d_s16", "c", false, true, conv_f32d_to_s16_c);
|
||||
#if defined (HAVE_SSE2)
|
||||
run_test("test_f32d_s16", "sse2", false, true, conv_f32d_to_s16_sse2);
|
||||
#endif
|
||||
run_test("test_f32_s16d", "c", true, false, conv_f32_to_s16d);
|
||||
run_test("test_f32_s16d", "c", true, false, conv_f32_to_s16d_c);
|
||||
}
|
||||
|
||||
static void test_s16_f32(void)
|
||||
{
|
||||
run_test("test_s16_f32", "c", true, true, conv_s16_to_f32);
|
||||
run_test("test_s16d_f32", "c", false, true, conv_s16d_to_f32);
|
||||
run_test("test_s16_f32d", "c", true, false, conv_s16_to_f32d);
|
||||
run_test("test_s16_f32", "c", true, true, conv_s16_to_f32_c);
|
||||
run_test("test_s16d_f32", "c", false, true, conv_s16d_to_f32_c);
|
||||
run_test("test_s16_f32d", "c", true, false, conv_s16_to_f32d_c);
|
||||
#if defined (HAVE_SSE2)
|
||||
run_test("test_s16_f32d", "sse2", true, false, conv_s16_to_f32d_sse2);
|
||||
#endif
|
||||
|
|
@ -140,33 +140,33 @@ static void test_s16_f32(void)
|
|||
|
||||
static void test_f32_s32(void)
|
||||
{
|
||||
run_test("test_f32_s32", "c", true, true, conv_f32_to_s32);
|
||||
run_test("test_f32d_s32", "c", false, true, conv_f32d_to_s32);
|
||||
run_test("test_f32_s32", "c", true, true, conv_f32_to_s32_c);
|
||||
run_test("test_f32d_s32", "c", false, true, conv_f32d_to_s32_c);
|
||||
#if defined (HAVE_SSE2)
|
||||
run_test("test_f32d_s32", "sse2", false, true, conv_f32d_to_s32_sse2);
|
||||
#endif
|
||||
run_test("test_f32_s32d", "c", true, false, conv_f32_to_s32d);
|
||||
run_test("test_f32_s32d", "c", true, false, conv_f32_to_s32d_c);
|
||||
}
|
||||
|
||||
static void test_s32_f32(void)
|
||||
{
|
||||
run_test("test_s32_f32", "c", true, true, conv_s32_to_f32);
|
||||
run_test("test_s32d_f32", "c", false, true, conv_s32d_to_f32);
|
||||
run_test("test_s32_f32d", "c", true, false, conv_s32_to_f32d);
|
||||
run_test("test_s32_f32", "c", true, true, conv_s32_to_f32_c);
|
||||
run_test("test_s32d_f32", "c", false, true, conv_s32d_to_f32_c);
|
||||
run_test("test_s32_f32d", "c", true, false, conv_s32_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s24(void)
|
||||
{
|
||||
run_test("test_f32_s24", "c", true, true, conv_f32_to_s24);
|
||||
run_test("test_f32d_s24", "c", false, true, conv_f32d_to_s24);
|
||||
run_test("test_f32_s24d", "c", true, false, conv_f32_to_s24d);
|
||||
run_test("test_f32_s24", "c", true, true, conv_f32_to_s24_c);
|
||||
run_test("test_f32d_s24", "c", false, true, conv_f32d_to_s24_c);
|
||||
run_test("test_f32_s24d", "c", true, false, conv_f32_to_s24d_c);
|
||||
}
|
||||
|
||||
static void test_s24_f32(void)
|
||||
{
|
||||
run_test("test_s24_f32", "c", true, true, conv_s24_to_f32);
|
||||
run_test("test_s24d_f32", "c", false, true, conv_s24d_to_f32);
|
||||
run_test("test_s24_f32d", "c", true, false, conv_s24_to_f32d);
|
||||
run_test("test_s24_f32", "c", true, true, conv_s24_to_f32_c);
|
||||
run_test("test_s24d_f32", "c", false, true, conv_s24d_to_f32_c);
|
||||
run_test("test_s24_f32d", "c", true, false, conv_s24_to_f32d_c);
|
||||
#if defined (HAVE_SSE2)
|
||||
run_test("test_s24_f32d", "sse2", true, false, conv_s24_to_f32d_sse2);
|
||||
#endif
|
||||
|
|
@ -180,32 +180,32 @@ static void test_s24_f32(void)
|
|||
|
||||
static void test_f32_s24_32(void)
|
||||
{
|
||||
run_test("test_f32_s24_32", "c", true, true, conv_f32_to_s24_32);
|
||||
run_test("test_f32d_s24_32", "c", false, true, conv_f32d_to_s24_32);
|
||||
run_test("test_f32_s24_32d", "c", true, false, conv_f32_to_s24_32d);
|
||||
run_test("test_f32_s24_32", "c", true, true, conv_f32_to_s24_32_c);
|
||||
run_test("test_f32d_s24_32", "c", false, true, conv_f32d_to_s24_32_c);
|
||||
run_test("test_f32_s24_32d", "c", true, false, conv_f32_to_s24_32d_c);
|
||||
}
|
||||
|
||||
static void test_s24_32_f32(void)
|
||||
{
|
||||
run_test("test_s24_32_f32", "c", true, true, conv_s24_32_to_f32);
|
||||
run_test("test_s24_32d_f32", "c", false, true, conv_s24_32d_to_f32);
|
||||
run_test("test_s24_32_f32d", "c", true, false, conv_s24_32_to_f32d);
|
||||
run_test("test_s24_32_f32", "c", true, true, conv_s24_32_to_f32_c);
|
||||
run_test("test_s24_32d_f32", "c", false, true, conv_s24_32d_to_f32_c);
|
||||
run_test("test_s24_32_f32d", "c", true, false, conv_s24_32_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_interleave(void)
|
||||
{
|
||||
run_test("test_interleave_8", "c", false, true, interleave_8);
|
||||
run_test("test_interleave_16", "c", false, true, interleave_16);
|
||||
run_test("test_interleave_24", "c", false, true, interleave_24);
|
||||
run_test("test_interleave_32", "c", false, true, interleave_32);
|
||||
run_test("test_interleave_8", "c", false, true, conv_interleave_8_c);
|
||||
run_test("test_interleave_16", "c", false, true, conv_interleave_16_c);
|
||||
run_test("test_interleave_24", "c", false, true, conv_interleave_24_c);
|
||||
run_test("test_interleave_32", "c", false, true, conv_interleave_32_c);
|
||||
}
|
||||
|
||||
static void test_deinterleave(void)
|
||||
{
|
||||
run_test("test_deinterleave_8", "c", true, false, deinterleave_8);
|
||||
run_test("test_deinterleave_16", "c", true, false, deinterleave_16);
|
||||
run_test("test_deinterleave_24", "c", true, false, deinterleave_24);
|
||||
run_test("test_deinterleave_32", "c", true, false, deinterleave_32);
|
||||
run_test("test_deinterleave_8", "c", true, false, conv_deinterleave_8_c);
|
||||
run_test("test_deinterleave_16", "c", true, false, conv_deinterleave_16_c);
|
||||
run_test("test_deinterleave_24", "c", true, false, conv_deinterleave_24_c);
|
||||
run_test("test_deinterleave_32", "c", true, false, conv_deinterleave_32_c);
|
||||
}
|
||||
|
||||
static int compare_func(const void *_a, const void *_b)
|
||||
|
|
|
|||
449
spa/plugins/audioconvert/channelmix-ops-c.c
Normal file
449
spa/plugins/audioconvert/channelmix-ops-c.c
Normal file
|
|
@ -0,0 +1,449 @@
|
|||
/* Spa
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "channelmix-ops.h"
|
||||
|
||||
void
|
||||
channelmix_copy_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
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++)
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[i][n] = s[i][n] * v;
|
||||
}
|
||||
}
|
||||
|
||||
#define _M(ch) (1UL << SPA_AUDIO_CHANNEL_ ## ch)
|
||||
|
||||
void
|
||||
channelmix_f32_n_m_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, j, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = 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];
|
||||
d[i][n] = sum * v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_MONO _M(FC)|_M(MONO)|_M(UNKNOWN)
|
||||
#define MASK_STEREO _M(FL)|_M(FR)|_M(UNKNOWN)
|
||||
|
||||
void
|
||||
channelmix_f32_1_2_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++)
|
||||
d[0][n] = d[1][n] = s[0][n];
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = d[1][n] = s[0][n] * v;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
channelmix_f32_2_1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
channelmix_f32_4_1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.25f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n] + s[3][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
channelmix_f32_3p1_1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MASK_QUAD _M(FL)|_M(FR)|_M(RL)|_M(RR)|_M(UNKNOWN)
|
||||
|
||||
void
|
||||
channelmix_f32_2_4_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = d[2][n] = s[0][n];
|
||||
d[1][n] = d[3][n] = s[1][n];
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_3_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)
|
||||
void
|
||||
channelmix_f32_2_3p1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = s[0][n];
|
||||
d[1][n] = s[1][n];
|
||||
d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
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[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_5_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
void
|
||||
channelmix_f32_2_5p1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = d[4][n] = s[0][n];
|
||||
d[1][n] = d[5][n] = s[1][n];
|
||||
d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
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[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR */
|
||||
void
|
||||
channelmix_f32_5p1_2_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+FC+LFE*/
|
||||
void
|
||||
channelmix_f32_5p1_3p1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+RL+RR*/
|
||||
void
|
||||
channelmix_f32_5p1_4_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_7_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR */
|
||||
void
|
||||
channelmix_f32_7p1_2_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR+FC+LFE*/
|
||||
void
|
||||
channelmix_f32_7p1_3p1_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR+RL+RR*/
|
||||
void
|
||||
channelmix_f32_7p1_4_c(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,9 +22,11 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "channelmix-ops.h"
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
static void
|
||||
void
|
||||
channelmix_copy_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
|
|
@ -70,7 +72,7 @@ channelmix_copy_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
channelmix_f32_2_4_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
|
|
@ -136,7 +138,7 @@ channelmix_f32_2_4_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
|||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR */
|
||||
static void
|
||||
void
|
||||
channelmix_f32_5p1_2_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
|
|
@ -228,7 +230,7 @@ channelmix_f32_5p1_2_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
|||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+FC+LFE*/
|
||||
static void
|
||||
void
|
||||
channelmix_f32_5p1_3p1_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
|
|
@ -311,7 +313,7 @@ channelmix_f32_5p1_3p1_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst]
|
|||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+RL+RR*/
|
||||
static void
|
||||
void
|
||||
channelmix_f32_5p1_4_sse(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
|
|
|
|||
|
|
@ -31,434 +31,16 @@
|
|||
#define VOLUME_MIN 0.0f
|
||||
#define VOLUME_NORM 1.0f
|
||||
|
||||
#if defined (__SSE__)
|
||||
#include "channelmix-ops-sse.c"
|
||||
#endif
|
||||
|
||||
static void
|
||||
channelmix_copy(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
for (i = 0; i < n_dst; i++)
|
||||
memset(d[i], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else if (v == VOLUME_NORM) {
|
||||
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++)
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[i][n] = s[i][n] * v;
|
||||
}
|
||||
}
|
||||
#include "channelmix-ops.h"
|
||||
|
||||
#define _M(ch) (1UL << SPA_AUDIO_CHANNEL_ ## ch)
|
||||
|
||||
static void
|
||||
channelmix_f32_n_m(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, j, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = 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];
|
||||
d[i][n] = sum * v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_MONO _M(FC)|_M(MONO)|_M(UNKNOWN)
|
||||
#define MASK_STEREO _M(FL)|_M(FR)|_M(UNKNOWN)
|
||||
|
||||
static void
|
||||
channelmix_f32_1_2(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++)
|
||||
d[0][n] = d[1][n] = s[0][n];
|
||||
}
|
||||
else {
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = d[1][n] = s[0][n] * v;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
channelmix_f32_2_1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
channelmix_f32_4_1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.25f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n] + s[3][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
channelmix_f32_3p1_1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
memset(d[0], 0, n_samples * sizeof(float));
|
||||
}
|
||||
else {
|
||||
const float f = v * 0.5f;
|
||||
for (n = 0; n < n_samples; n++)
|
||||
d[0][n] = (s[0][n] + s[1][n] + s[2][n]) * f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MASK_QUAD _M(FL)|_M(FR)|_M(RL)|_M(RR)|_M(UNKNOWN)
|
||||
|
||||
static void
|
||||
channelmix_f32_2_4(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = d[2][n] = s[0][n];
|
||||
d[1][n] = d[3][n] = s[1][n];
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_3_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)
|
||||
static void
|
||||
channelmix_f32_2_3p1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = s[0][n];
|
||||
d[1][n] = s[1][n];
|
||||
d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
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[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_5_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
static void
|
||||
channelmix_f32_2_5p1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **)dst;
|
||||
const float **s = (const float **)src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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++) {
|
||||
d[0][n] = d[4][n] = s[0][n];
|
||||
d[1][n] = d[5][n] = s[1][n];
|
||||
d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
|
||||
d[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
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[3][n] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR */
|
||||
static void
|
||||
channelmix_f32_5p1_2(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+FC+LFE*/
|
||||
static void
|
||||
channelmix_f32_5p1_3p1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR -> FL+FR+RL+RR*/
|
||||
static void
|
||||
channelmix_f32_5p1_4(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MASK_7_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR */
|
||||
static void
|
||||
channelmix_f32_7p1_2(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR+FC+LFE*/
|
||||
static void
|
||||
channelmix_f32_7p1_3p1(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FL+FR+FC+LFE+SL+SR+RL+RR -> FL+FR+RL+RR*/
|
||||
static void
|
||||
channelmix_f32_7p1_4(void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void *matrix, float v, int n_samples)
|
||||
{
|
||||
int i, n;
|
||||
float **d = (float **) dst;
|
||||
const float **s = (const float **) src;
|
||||
const float *m = matrix;
|
||||
const float clev = m[2];
|
||||
const float llev = m[3];
|
||||
const float slev = m[4];
|
||||
|
||||
if (v <= VOLUME_MIN) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*channelmix_func_t) (void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void * SPA_RESTRICT matrix, float v, int n_samples);
|
||||
|
|
@ -478,44 +60,44 @@ static const struct channelmix_info {
|
|||
uint32_t features;
|
||||
} channelmix_table[] =
|
||||
{
|
||||
#if defined (__SSE__)
|
||||
#if defined (HAVE_SSE)
|
||||
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_sse, FEATURE_SSE },
|
||||
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_sse, FEATURE_SSE },
|
||||
{ EQ, 0, EQ, 0, channelmix_copy_sse, FEATURE_SSE },
|
||||
#endif
|
||||
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy, 0 },
|
||||
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy, 0 },
|
||||
{ EQ, 0, EQ, 0, channelmix_copy, 0 },
|
||||
{ 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_c, 0 },
|
||||
{ 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_c, 0 },
|
||||
{ EQ, 0, EQ, 0, channelmix_copy_c, 0 },
|
||||
|
||||
{ 1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2, 0 },
|
||||
{ 2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1, 0 },
|
||||
{ 4, MASK_QUAD, 1, MASK_MONO, channelmix_f32_4_1, 0 },
|
||||
{ 4, MASK_3_1, 1, MASK_MONO, channelmix_f32_3p1_1, 0 },
|
||||
#if defined (__SSE__)
|
||||
{ 1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2_c, 0 },
|
||||
{ 2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1_c, 0 },
|
||||
{ 4, MASK_QUAD, 1, MASK_MONO, channelmix_f32_4_1_c, 0 },
|
||||
{ 4, MASK_3_1, 1, MASK_MONO, channelmix_f32_3p1_1_c, 0 },
|
||||
#if defined (HAVE_SSE)
|
||||
{ 2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4_sse, FEATURE_SSE },
|
||||
#endif
|
||||
{ 2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4, 0 },
|
||||
{ 2, MASK_STEREO, 4, MASK_3_1, channelmix_f32_2_3p1, 0 },
|
||||
{ 2, MASK_STEREO, 6, MASK_5_1, channelmix_f32_2_5p1, 0 },
|
||||
#if defined (__SSE__)
|
||||
{ 2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4_c, 0 },
|
||||
{ 2, MASK_STEREO, 4, MASK_3_1, channelmix_f32_2_3p1_c, 0 },
|
||||
{ 2, MASK_STEREO, 6, MASK_5_1, channelmix_f32_2_5p1_c, 0 },
|
||||
#if defined (HAVE_SSE)
|
||||
{ 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_sse, FEATURE_SSE },
|
||||
#endif
|
||||
{ 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2, 0 },
|
||||
#if defined (__SSE__)
|
||||
{ 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_c, 0 },
|
||||
#if defined (HAVE_SSE)
|
||||
{ 6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_sse, FEATURE_SSE },
|
||||
#endif
|
||||
{ 6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4, 0 },
|
||||
{ 6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_c, 0 },
|
||||
|
||||
#if defined (__SSE__)
|
||||
#if defined (HAVE_SSE)
|
||||
{ 6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_sse, FEATURE_SSE },
|
||||
#endif
|
||||
{ 6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1, 0 },
|
||||
{ 6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_c, 0 },
|
||||
|
||||
{ 8, MASK_7_1, 2, MASK_STEREO, channelmix_f32_7p1_2, 0 },
|
||||
{ 8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4, 0 },
|
||||
{ 8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1, 0 },
|
||||
{ 8, MASK_7_1, 2, MASK_STEREO, channelmix_f32_7p1_2_c, 0 },
|
||||
{ 8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4_c, 0 },
|
||||
{ 8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1_c, 0 },
|
||||
|
||||
{ ANY, 0, ANY, 0, channelmix_f32_n_m, 0 },
|
||||
{ ANY, 0, ANY, 0, channelmix_f32_n_m_c, 0 },
|
||||
};
|
||||
|
||||
#define MATCH_CHAN(a,b) ((a) == ANY || (a) == (b))
|
||||
|
|
|
|||
74
spa/plugins/audioconvert/channelmix-ops.h
Normal file
74
spa/plugins/audioconvert/channelmix-ops.h
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/* Spa
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
|
||||
#define VOLUME_MIN 0.0f
|
||||
#define VOLUME_NORM 1.0f
|
||||
|
||||
#define _M(ch) (1UL << SPA_AUDIO_CHANNEL_ ## ch)
|
||||
#define MASK_MONO _M(FC)|_M(MONO)|_M(UNKNOWN)
|
||||
#define MASK_STEREO _M(FL)|_M(FR)|_M(UNKNOWN)
|
||||
#define MASK_QUAD _M(FL)|_M(FR)|_M(RL)|_M(RR)|_M(UNKNOWN)
|
||||
#define MASK_3_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)
|
||||
#define MASK_5_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
#define MASK_7_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR)
|
||||
|
||||
typedef void (*channelmix_func_t) (void *data, int n_dst, void * SPA_RESTRICT dst[n_dst],
|
||||
int n_src, const void * SPA_RESTRICT src[n_src],
|
||||
const void * SPA_RESTRICT matrix, float v, int n_samples);
|
||||
|
||||
#define DEFINE_FUNCTION(name,arch) \
|
||||
void channelmix_##name##_##arch(void *data, \
|
||||
int n_dst, void * SPA_RESTRICT dst[n_dst], \
|
||||
int n_src, const void * SPA_RESTRICT src[n_src], \
|
||||
const void *matrix, float v, int n_samples);
|
||||
|
||||
DEFINE_FUNCTION(copy, c);
|
||||
DEFINE_FUNCTION(f32_n_m, c);
|
||||
DEFINE_FUNCTION(f32_1_2, c);
|
||||
DEFINE_FUNCTION(f32_2_1, c);
|
||||
DEFINE_FUNCTION(f32_4_1, c);
|
||||
DEFINE_FUNCTION(f32_3p1_1, c);
|
||||
DEFINE_FUNCTION(f32_2_4, c);
|
||||
DEFINE_FUNCTION(f32_2_3p1, c);
|
||||
DEFINE_FUNCTION(f32_2_5p1, c);
|
||||
DEFINE_FUNCTION(f32_5p1_2, c);
|
||||
DEFINE_FUNCTION(f32_5p1_3p1, c);
|
||||
DEFINE_FUNCTION(f32_5p1_4, c);
|
||||
DEFINE_FUNCTION(f32_7p1_2, c);
|
||||
DEFINE_FUNCTION(f32_7p1_3p1, c);
|
||||
DEFINE_FUNCTION(f32_7p1_4, c);
|
||||
|
||||
#if defined (HAVE_SSE)
|
||||
DEFINE_FUNCTION(copy, sse);
|
||||
DEFINE_FUNCTION(f32_2_4, sse);
|
||||
DEFINE_FUNCTION(f32_5p1_2, sse);
|
||||
DEFINE_FUNCTION(f32_5p1_3p1, sse);
|
||||
DEFINE_FUNCTION(f32_5p1_4, sse);
|
||||
DEFINE_FUNCTION(f32_7p1_4, sse);
|
||||
#endif
|
||||
670
spa/plugins/audioconvert/fmt-ops-c.c
Normal file
670
spa/plugins/audioconvert/fmt-ops-c.c
Normal file
|
|
@ -0,0 +1,670 @@
|
|||
/* Spa
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <spa/support/cpu.h>
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
|
||||
#include "fmt-ops.h"
|
||||
|
||||
void
|
||||
conv_copy8d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples);
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy8_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * n_channels);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
conv_copy16d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * sizeof(int16_t));
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy16_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * sizeof(int16_t) * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy24d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * 3);
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy24_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * 3 * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * sizeof(int32_t));
|
||||
}
|
||||
|
||||
void
|
||||
conv_copy32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * sizeof(int32_t) * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_u8d_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const uint8_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = U8_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_u8_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_u8d_to_f32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_u8_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = U8_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_u8d_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t **s = (const uint8_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = U8_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s16d_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int16_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S16_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s16_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s16d_to_f32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_s16_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S16_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s16d_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t **s = (const int16_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S16_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s32d_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int32_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S32_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s32_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s32d_to_f32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_s32_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S32_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s32d_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S32_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24d_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int8_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
d[j] = S24_TO_F32(read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s24d_to_f32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
d[i][j] = S24_TO_F32(read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24d_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t **s = (const uint8_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
*d++ = S24_TO_F32(read_s24(&s[i][j*3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_32d_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int32_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S24_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_32_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s24_32d_to_f32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_32_to_f32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S24_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_s24_32d_to_f32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S24_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_u8d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
uint8_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_U8(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_u8_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_u8d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_u8d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_U8(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_u8_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_U8(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s16d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int16_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S16(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s16_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s16d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s16d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int16_t **d = (int16_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S16(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s16_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int16_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S16(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int32_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int32_t **d = (int32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
conv_f32d_to_s24d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
uint8_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
write_s24(d, F32_TO_S24(s[j]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s24_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s24d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s24d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(&d[i][j*3], F32_TO_S24(*s++));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s24_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(d, F32_TO_S24(s[i][j]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
conv_f32d_to_s24_32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int32_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S24(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s24_32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s24_32d_c(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32_to_s24_32d_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int32_t **d = (int32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S24(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_f32d_to_s24_32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S24(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_deinterleave_8_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_deinterleave_16_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint16_t *s = src[0];
|
||||
uint16_t **d = (uint16_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_deinterleave_24_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(&d[i][j*3], read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_deinterleave_32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint32_t *s = src[0];
|
||||
uint32_t **d = (uint32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_interleave_8_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int8_t **s = (const int8_t **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_interleave_16_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t **s = (const int16_t **) src;
|
||||
uint16_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_interleave_24_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int8_t **s = (const int8_t **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(d, read_s24(&s[i][j*3]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
conv_interleave_32_c(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
uint32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
|
@ -32,643 +32,6 @@
|
|||
|
||||
#include "fmt-ops.h"
|
||||
|
||||
static void
|
||||
conv_copy8d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy8(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * n_channels);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
conv_copy16d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * sizeof(int16_t));
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy16(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * sizeof(int16_t) * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy24d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * 3);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy24(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * 3 * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n_channels; i++)
|
||||
spa_memcpy(dst[i], src[i], n_samples * sizeof(int32_t));
|
||||
}
|
||||
|
||||
static void
|
||||
conv_copy32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
spa_memcpy(dst[0], src[0], n_samples * sizeof(int32_t) * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_u8d_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const uint8_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = U8_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_u8_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_u8d_to_f32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_u8_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = U8_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_u8d_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t **s = (const uint8_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = U8_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s16d_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int16_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S16_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s16_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s16d_to_f32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s16_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S16_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s16d_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t **s = (const int16_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S16_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s32d_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int32_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S32_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s32_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s32d_to_f32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s32_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S32_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s32d_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S32_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24d_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int8_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
d[j] = S24_TO_F32(read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s24d_to_f32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
d[i][j] = S24_TO_F32(read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24d_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t **s = (const uint8_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
*d++ = S24_TO_F32(read_s24(&s[i][j*3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_32d_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const int32_t *s = src[i];
|
||||
float *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = S24_TO_F32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_32_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_s24_32d_to_f32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_32_to_f32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t *s = src[0];
|
||||
float **d = (float **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = S24_TO_F32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_s24_32d_to_f32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
float *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = S24_TO_F32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_u8d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
uint8_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_U8(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_u8(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_u8d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_u8d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_U8(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_u8(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_U8(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s16d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int16_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S16(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s16(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s16d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s16d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int16_t **d = (int16_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S16(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s16(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int16_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S16(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int32_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S32(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int32_t **d = (int32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S32(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S32(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
conv_f32d_to_s24d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
uint8_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
write_s24(d, F32_TO_S24(s[j]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s24(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s24d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s24d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(&d[i][j*3], F32_TO_S24(*s++));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s24(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(d, F32_TO_S24(s[i][j]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
conv_f32d_to_s24_32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
const float *s = src[i];
|
||||
int32_t *d = dst[i];
|
||||
|
||||
for (j = 0; j < n_samples; j++)
|
||||
d[j] = F32_TO_S24(s[j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s24_32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
conv_f32d_to_s24_32d(data, dst, src, 1, n_samples * n_channels);
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32_to_s24_32d(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float *s = src[0];
|
||||
int32_t **d = (int32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = F32_TO_S24(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_f32d_to_s24_32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const float **s = (const float **) src;
|
||||
int32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = F32_TO_S24(s[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterleave_8(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterleave_16(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint16_t *s = src[0];
|
||||
uint16_t **d = (uint16_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterleave_24(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint8_t *s = src[0];
|
||||
uint8_t **d = (uint8_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(&d[i][j*3], read_s24(s));
|
||||
s += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
deinterleave_32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const uint32_t *s = src[0];
|
||||
uint32_t **d = (uint32_t **) dst;
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
d[i][j] = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
interleave_8(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int8_t **s = (const int8_t **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
interleave_16(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int16_t **s = (const int16_t **) src;
|
||||
uint16_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
interleave_24(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int8_t **s = (const int8_t **) src;
|
||||
uint8_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++) {
|
||||
write_s24(d, read_s24(&s[i][j*3]));
|
||||
d += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
interleave_32(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[], uint32_t n_channels, uint32_t n_samples)
|
||||
{
|
||||
const int32_t **s = (const int32_t **) src;
|
||||
uint32_t *d = dst[0];
|
||||
uint32_t i, j;
|
||||
|
||||
for (j = 0; j < n_samples; j++) {
|
||||
for (i = 0; i < n_channels; i++)
|
||||
*d++ = s[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
struct conv_info {
|
||||
uint32_t src_fmt;
|
||||
uint32_t dst_fmt;
|
||||
|
|
@ -683,32 +46,32 @@ struct conv_info {
|
|||
static struct conv_info conv_table[] =
|
||||
{
|
||||
/* to f32 */
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32, 0, conv_u8_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32P, 0, conv_u8d_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32P, 0, conv_u8_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32, 0, conv_u8d_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32, 0, conv_u8_to_f32_c },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32P, 0, conv_u8d_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32P, 0, conv_u8_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32, 0, conv_u8d_to_f32_c },
|
||||
|
||||
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32, 0, conv_s16_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32P, 0, conv_s16d_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32, 0, conv_s16_to_f32_c },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32P, 0, conv_s16d_to_f32d_c },
|
||||
#if defined (HAVE_SSE2)
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, FEATURE_SSE2, conv_s16_to_f32d_sse2 },
|
||||
#endif
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, conv_s16_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32, 0, conv_s16d_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, conv_s16_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32, 0, conv_s16d_to_f32_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32, 0, conv_copy32 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32P, 0, conv_copy32d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32P, 0, deinterleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32, 0, interleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32, 0, conv_copy32_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32P, 0, conv_copy32d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32P, 0, conv_deinterleave_32_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32, 0, conv_interleave_32_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32, 0, conv_s32_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32P, 0, conv_s32d_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32P, 0, conv_s32_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32, 0, conv_s32d_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32, 0, conv_s32_to_f32_c },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32P, 0, conv_s32d_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32P, 0, conv_s32_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32, 0, conv_s32d_to_f32_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32, 0, conv_s24_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32P, 0, conv_s24d_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32, 0, conv_s24_to_f32_c },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32P, 0, conv_s24d_to_f32d_c },
|
||||
#if defined (HAVE_SSSE3)
|
||||
// { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, FEATURE_SSSE3, conv_s24_to_f32d_ssse3 },
|
||||
#endif
|
||||
|
|
@ -718,75 +81,75 @@ static struct conv_info conv_table[] =
|
|||
#if defined (HAVE_SSE2)
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, FEATURE_SSE2, conv_s24_to_f32d_sse2 },
|
||||
#endif
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32, 0, conv_s24d_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32, 0, conv_s24d_to_f32_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32, 0, conv_s24_32_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_32d_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_32_to_f32d },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32, 0, conv_s24_32d_to_f32 },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32, 0, conv_s24_32_to_f32_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_32d_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32P, 0, conv_s24_32_to_f32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32, 0, conv_s24_32d_to_f32_c },
|
||||
|
||||
/* from f32 */
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_U8, 0, conv_f32_to_u8 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_U8P, 0, conv_f32d_to_u8d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_U8P, 0, conv_f32_to_u8d },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_U8, 0, conv_f32d_to_u8 },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_U8, 0, conv_f32_to_u8_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_U8P, 0, conv_f32d_to_u8d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_U8P, 0, conv_f32_to_u8d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_U8, 0, conv_f32d_to_u8_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S16, 0, conv_f32_to_s16 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S16P, 0, conv_f32d_to_s16d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S16P, 0, conv_f32_to_s16d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S16, 0, conv_f32_to_s16_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S16P, 0, conv_f32d_to_s16d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S16P, 0, conv_f32_to_s16d_c },
|
||||
#if defined (HAVE_SSE2)
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S16, FEATURE_SSE2, conv_f32d_to_s16_sse2 },
|
||||
#endif
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S16, 0, conv_f32d_to_s16 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S16, 0, conv_f32d_to_s16_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S32, 0, conv_f32_to_s32 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S32P, 0, conv_f32d_to_s32d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S32P, 0, conv_f32_to_s32d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S32, 0, conv_f32_to_s32_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S32P, 0, conv_f32d_to_s32d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S32P, 0, conv_f32_to_s32d_c },
|
||||
#if defined (HAVE_SSE2)
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S32, FEATURE_SSE2, conv_f32d_to_s32_sse2 },
|
||||
#endif
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S32, 0, conv_f32d_to_s32 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S32, 0, conv_f32d_to_s32_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24, 0, conv_f32_to_s24 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24P, 0, conv_f32d_to_s24d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24P, 0, conv_f32_to_s24d },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24, 0, conv_f32d_to_s24 },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24, 0, conv_f32_to_s24_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24P, 0, conv_f32d_to_s24d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24P, 0, conv_f32_to_s24d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24, 0, conv_f32d_to_s24_c },
|
||||
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24_32, 0, conv_f32_to_s24_32 },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24_32P, 0, conv_f32d_to_s24_32d },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24_32P, 0, conv_f32_to_s24_32d },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24_32, 0, conv_f32d_to_s24_32 },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24_32, 0, conv_f32_to_s24_32_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24_32P, 0, conv_f32d_to_s24_32d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_S24_32P, 0, conv_f32_to_s24_32d_c },
|
||||
{ SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_S24_32, 0, conv_f32d_to_s24_32_c },
|
||||
|
||||
/* u8 */
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_U8, 0, conv_copy8 },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_U8P, 0, conv_copy8d },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_U8P, 0, deinterleave_8 },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_U8, 0, interleave_8 },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_U8, 0, conv_copy8_c },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_U8P, 0, conv_copy8d_c },
|
||||
{ SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_U8P, 0, conv_deinterleave_8_c },
|
||||
{ SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_U8, 0, conv_interleave_8_c },
|
||||
|
||||
/* s16 */
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_S16, 0, conv_copy16 },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_S16P, 0, conv_copy16d },
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_S16P, 0, deinterleave_16 },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_S16, 0, interleave_16 },
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_S16, 0, conv_copy16_c },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_S16P, 0, conv_copy16d_c },
|
||||
{ SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_S16P, 0, conv_deinterleave_16_c },
|
||||
{ SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_S16, 0, conv_interleave_16_c },
|
||||
|
||||
/* s32 */
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_S32, 0, conv_copy32 },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_S32P, 0, conv_copy32d },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_S32P, 0, deinterleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_S32, 0, interleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_S32, 0, conv_copy32_c },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_S32P, 0, conv_copy32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_S32P, 0, conv_deinterleave_32_c },
|
||||
{ SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_S32, 0, conv_interleave_32_c },
|
||||
|
||||
/* s24 */
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_S24, 0, conv_copy24 },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_S24P, 0, conv_copy24d },
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_S24P, 0, deinterleave_24 },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_S24, 0, interleave_24 },
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_S24, 0, conv_copy24_c },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_S24P, 0, conv_copy24d_c },
|
||||
{ SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_S24P, 0, conv_deinterleave_24_c },
|
||||
{ SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_S24, 0, conv_interleave_24_c },
|
||||
|
||||
/* s24_32 */
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_S24_32, 0, conv_copy32 },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_S24_32P, 0, conv_copy32d },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_S24_32P, 0, deinterleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_S24_32, 0, interleave_32 },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_S24_32, 0, conv_copy32_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_S24_32P, 0, conv_copy32d_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_S24_32P, 0, conv_deinterleave_32_c },
|
||||
{ SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_S24_32, 0, conv_interleave_32_c },
|
||||
};
|
||||
|
||||
static const struct conv_info *find_conv_info(uint32_t src_fmt, uint32_t dst_fmt, uint32_t features)
|
||||
|
|
|
|||
|
|
@ -80,22 +80,78 @@ static inline void write_s24(void *dst, int32_t val)
|
|||
typedef void (*convert_func_t) (void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
|
||||
#define DEFINE_FUNCTION(name,arch) \
|
||||
void conv_##name##_##arch(void *data, void * SPA_RESTRICT dst[], \
|
||||
const void * SPA_RESTRICT src[], \
|
||||
uint32_t n_channels, uint32_t n_samples)
|
||||
|
||||
DEFINE_FUNCTION(copy8d, c);
|
||||
DEFINE_FUNCTION(copy8, c);
|
||||
DEFINE_FUNCTION(copy16d, c);
|
||||
DEFINE_FUNCTION(copy16, c);
|
||||
DEFINE_FUNCTION(copy24d, c);
|
||||
DEFINE_FUNCTION(copy24, c);
|
||||
DEFINE_FUNCTION(copy32d, c);
|
||||
DEFINE_FUNCTION(copy32, c);
|
||||
DEFINE_FUNCTION(u8d_to_f32d, c);
|
||||
DEFINE_FUNCTION(u8_to_f32, c);
|
||||
DEFINE_FUNCTION(u8_to_f32d, c);
|
||||
DEFINE_FUNCTION(u8d_to_f32, c);
|
||||
DEFINE_FUNCTION(s16d_to_f32d, c);
|
||||
DEFINE_FUNCTION(s16_to_f32, c);
|
||||
DEFINE_FUNCTION(s16_to_f32d, c);
|
||||
DEFINE_FUNCTION(s16d_to_f32, c);
|
||||
DEFINE_FUNCTION(s32d_to_f32d, c);
|
||||
DEFINE_FUNCTION(s32_to_f32, c);
|
||||
DEFINE_FUNCTION(s32_to_f32d, c);
|
||||
DEFINE_FUNCTION(s32d_to_f32, c);
|
||||
DEFINE_FUNCTION(s24d_to_f32d, c);
|
||||
DEFINE_FUNCTION(s24_to_f32, c);
|
||||
DEFINE_FUNCTION(s24_to_f32d, c);
|
||||
DEFINE_FUNCTION(s24d_to_f32, c);
|
||||
DEFINE_FUNCTION(s24_32d_to_f32d, c);
|
||||
DEFINE_FUNCTION(s24_32_to_f32, c);
|
||||
DEFINE_FUNCTION(s24_32_to_f32d, c);
|
||||
DEFINE_FUNCTION(s24_32d_to_f32, c);
|
||||
DEFINE_FUNCTION(f32d_to_u8d, c);
|
||||
DEFINE_FUNCTION(f32_to_u8, c);
|
||||
DEFINE_FUNCTION(f32_to_u8d, c);
|
||||
DEFINE_FUNCTION(f32d_to_u8, c);
|
||||
DEFINE_FUNCTION(f32d_to_s16d, c);
|
||||
DEFINE_FUNCTION(f32_to_s16, c);
|
||||
DEFINE_FUNCTION(f32_to_s16d, c);
|
||||
DEFINE_FUNCTION(f32d_to_s16, c);
|
||||
DEFINE_FUNCTION(f32d_to_s32d, c);
|
||||
DEFINE_FUNCTION(f32_to_s32, c);
|
||||
DEFINE_FUNCTION(f32_to_s32d, c);
|
||||
DEFINE_FUNCTION(f32d_to_s32, c);
|
||||
DEFINE_FUNCTION(f32d_to_s24d, c);
|
||||
DEFINE_FUNCTION(f32_to_s24, c);
|
||||
DEFINE_FUNCTION(f32_to_s24d, c);
|
||||
DEFINE_FUNCTION(f32d_to_s24, c);
|
||||
DEFINE_FUNCTION(f32d_to_s24_32d, c);
|
||||
DEFINE_FUNCTION(f32_to_s24_32, c);
|
||||
DEFINE_FUNCTION(f32_to_s24_32d, c);
|
||||
DEFINE_FUNCTION(f32d_to_s24_32, c);
|
||||
DEFINE_FUNCTION(deinterleave_8, c);
|
||||
DEFINE_FUNCTION(deinterleave_16, c);
|
||||
DEFINE_FUNCTION(deinterleave_24, c);
|
||||
DEFINE_FUNCTION(deinterleave_32, c);
|
||||
DEFINE_FUNCTION(interleave_8, c);
|
||||
DEFINE_FUNCTION(interleave_16, c);
|
||||
DEFINE_FUNCTION(interleave_24, c);
|
||||
DEFINE_FUNCTION(interleave_32, c);
|
||||
|
||||
#if defined(HAVE_SSE2)
|
||||
void conv_s16_to_f32d_sse2(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
void conv_s24_to_f32d_sse2(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
void conv_f32d_to_s32_sse2(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
void conv_f32d_to_s16_sse2(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
DEFINE_FUNCTION(s16_to_f32d, sse2);
|
||||
DEFINE_FUNCTION(s24_to_f32d, sse2);
|
||||
DEFINE_FUNCTION(f32d_to_s32, sse2);
|
||||
DEFINE_FUNCTION(f32d_to_s16, sse2);
|
||||
#endif
|
||||
#if defined(HAVE_SSSE3)
|
||||
void conv_s24_to_f32d_ssse3(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
DEFINE_FUNCTION(s24_to_f32d, ssse3);
|
||||
#endif
|
||||
#if defined(HAVE_SSE41)
|
||||
void conv_s24_to_f32d_sse41(void *data, void * SPA_RESTRICT dst[], const void * SPA_RESTRICT src[],
|
||||
uint32_t n_channels, uint32_t n_samples);
|
||||
DEFINE_FUNCTION(s24_to_f32d, sse41);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,10 +9,21 @@ audioconvert_sources = ['fmtconvert.c',
|
|||
simd_cargs = []
|
||||
simd_dependencies = []
|
||||
|
||||
audioconvert_c = static_library('audioconvert_c',
|
||||
['resample-native-c.c',
|
||||
'channelmix-ops-c.c',
|
||||
'fmt-ops-c.c' ],
|
||||
c_args : ['-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
simd_dependencies += audioconvert_c
|
||||
|
||||
if have_sse
|
||||
audioconvert_sse = static_library('audioconvert_sse',
|
||||
['resample-native-sse.c'],
|
||||
c_args : [sse_args],
|
||||
['resample-native-sse.c',
|
||||
'channelmix-ops-sse.c' ],
|
||||
c_args : [sse_args, '-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
|
|
@ -21,8 +32,8 @@ if have_sse
|
|||
endif
|
||||
if have_sse2
|
||||
audioconvert_sse2 = static_library('audioconvert_sse2',
|
||||
['fmt-ops-sse2.c'],
|
||||
c_args : [sse2_args],
|
||||
['fmt-ops-sse2.c' ],
|
||||
c_args : [sse2_args, '-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
|
|
@ -33,7 +44,7 @@ if have_ssse3
|
|||
audioconvert_ssse3 = static_library('audioconvert_ssse3',
|
||||
['fmt-ops-ssse3.c',
|
||||
'resample-native-ssse3.c' ],
|
||||
c_args : [ssse3_args],
|
||||
c_args : [ssse3_args, '-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
|
|
@ -43,7 +54,7 @@ endif
|
|||
if have_sse41
|
||||
audioconvert_sse41 = static_library('audioconvert_sse41',
|
||||
['fmt-ops-sse41.c'],
|
||||
c_args : [sse41_args],
|
||||
c_args : [sse41_args, '-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
|
|
@ -53,7 +64,7 @@ endif
|
|||
if have_avx and have_fma
|
||||
audioconvert_avx = static_library('audioconvert_avx',
|
||||
['resample-native-avx.c'],
|
||||
c_args : [avx2_args, fma_args],
|
||||
c_args : [avx2_args, fma_args, '-O3'],
|
||||
include_directories : [spa_inc],
|
||||
install : false
|
||||
)
|
||||
|
|
@ -80,6 +91,7 @@ foreach a : test_apps
|
|||
executable(a, a + '.c',
|
||||
dependencies : [dl_lib, pthread_lib, mathlib ],
|
||||
include_directories : [spa_inc ],
|
||||
link_with : simd_dependencies,
|
||||
c_args : [ '-D_GNU_SOURCE' ],
|
||||
install : false),
|
||||
env : [
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "resample-native-impl.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <immintrin.h>
|
||||
|
||||
static void inner_product_avx(float *d, const float * SPA_RESTRICT s,
|
||||
|
|
@ -31,13 +32,15 @@ static void inner_product_avx(float *d, const float * SPA_RESTRICT s,
|
|||
{
|
||||
__m256 sy[2] = { _mm256_setzero_ps(), _mm256_setzero_ps() };
|
||||
__m128 sx[2];
|
||||
uint32_t i, n_taps4 = n_taps & ~0xf;
|
||||
uint32_t i = 0;
|
||||
uint32_t n_taps4 = n_taps & ~0xf;
|
||||
|
||||
for (i = 0; i < n_taps4; i += 16) {
|
||||
for (; i < n_taps4; i += 16) {
|
||||
sy[0] = _mm256_fmadd_ps(_mm256_loadu_ps(s + i + 0), _mm256_load_ps(taps + i + 0), sy[0]);
|
||||
sy[1] = _mm256_fmadd_ps(_mm256_loadu_ps(s + i + 8), _mm256_load_ps(taps + i + 8), sy[1]);
|
||||
}
|
||||
sy[0] = _mm256_add_ps(sy[0], sy[1]);
|
||||
|
||||
sx[0] = _mm256_extractf128_ps(sy[0], 0);
|
||||
sx[1] = _mm256_extractf128_ps(sy[0], 1);
|
||||
for (; i < n_taps; i += 8) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "resample-native-impl.h"
|
||||
|
||||
static void inner_product_c(float *d, const float * SPA_RESTRICT s,
|
||||
const float * SPA_RESTRICT taps, uint32_t n_taps)
|
||||
{
|
||||
|
|
@ -51,6 +51,11 @@ struct native_data {
|
|||
float *hist_mem;
|
||||
};
|
||||
|
||||
#define DEFINE_RESAMPLER_COPY(arch) \
|
||||
void do_resample_copy_##arch(struct resample *r, \
|
||||
const void * SPA_RESTRICT src[], uint32_t *in_len, \
|
||||
void * SPA_RESTRICT dst[], uint32_t offs, uint32_t *out_len)
|
||||
|
||||
#define DEFINE_RESAMPLER_FULL(arch) \
|
||||
void do_resample_full_##arch(struct resample *r, \
|
||||
const void * SPA_RESTRICT src[], uint32_t *in_len, \
|
||||
|
|
@ -62,9 +67,7 @@ void do_resample_inter_##arch(struct resample *r, \
|
|||
void * SPA_RESTRICT dst[], uint32_t offs, uint32_t *out_len)
|
||||
|
||||
#define MAKE_RESAMPLER_COPY(arch) \
|
||||
static void do_resample_copy_##arch(struct resample *r, \
|
||||
const void * SPA_RESTRICT src[], uint32_t *in_len, \
|
||||
void * SPA_RESTRICT dst[], uint32_t offs, uint32_t *out_len) \
|
||||
DEFINE_RESAMPLER_COPY(arch) \
|
||||
{ \
|
||||
struct native_data *data = r->data; \
|
||||
uint32_t index, n_taps = data->n_taps; \
|
||||
|
|
@ -177,6 +180,7 @@ DEFINE_RESAMPLER_INTER(arch) \
|
|||
}
|
||||
|
||||
|
||||
DEFINE_RESAMPLER_COPY(c);
|
||||
DEFINE_RESAMPLER_FULL(c);
|
||||
DEFINE_RESAMPLER_INTER(c);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#include "resample-native-impl.h"
|
||||
#include "resample-native-c.h"
|
||||
|
||||
struct quality {
|
||||
uint32_t n_taps;
|
||||
|
|
|
|||
|
|
@ -62,16 +62,16 @@ static void run_test(const char *name,
|
|||
tp[0] = temp_in;
|
||||
switch(in_size) {
|
||||
case 1:
|
||||
interleave_8(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
conv_interleave_8_c(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
break;
|
||||
case 2:
|
||||
interleave_16(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
conv_interleave_16_c(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
break;
|
||||
case 3:
|
||||
interleave_24(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
conv_interleave_24_c(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
break;
|
||||
case 4:
|
||||
interleave_32(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
conv_interleave_32_c(NULL, tp, ip, N_CHANNELS, N_SAMPLES);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unknown size %zd\n", in_size);
|
||||
|
|
@ -109,13 +109,13 @@ static void test_f32_u8(void)
|
|||
uint8_t out[] = { 128, 255, 0, 191, 64, 255, 0, };
|
||||
|
||||
run_test("test_f32_u8", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_f32_to_u8);
|
||||
true, true, conv_f32_to_u8_c);
|
||||
run_test("test_f32d_u8", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_f32d_to_u8);
|
||||
false, true, conv_f32d_to_u8_c);
|
||||
run_test("test_f32_u8d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_f32_to_u8d);
|
||||
true, false, conv_f32_to_u8d_c);
|
||||
run_test("test_f32d_u8d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_f32d_to_u8d);
|
||||
false, false, conv_f32d_to_u8d_c);
|
||||
}
|
||||
|
||||
static void test_u8_f32(void)
|
||||
|
|
@ -124,13 +124,13 @@ static void test_u8_f32(void)
|
|||
const float out[] = { 0.0f, 0.9921875f, -1.0f, 0.5f, -0.5f, };
|
||||
|
||||
run_test("test_u8_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_u8_to_f32);
|
||||
true, true, conv_u8_to_f32_c);
|
||||
run_test("test_u8d_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_u8d_to_f32);
|
||||
false, true, conv_u8d_to_f32_c);
|
||||
run_test("test_u8_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_u8_to_f32d);
|
||||
true, false, conv_u8_to_f32d_c);
|
||||
run_test("test_u8d_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_u8d_to_f32d);
|
||||
false, false, conv_u8d_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s16(void)
|
||||
|
|
@ -139,13 +139,13 @@ static void test_f32_s16(void)
|
|||
const int16_t out[] = { 0, 32767, -32767, 16383, -16383, 32767, -32767 };
|
||||
|
||||
run_test("test_f32_s16", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_f32_to_s16);
|
||||
true, true, conv_f32_to_s16_c);
|
||||
run_test("test_f32d_s16", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_f32d_to_s16);
|
||||
false, true, conv_f32d_to_s16_c);
|
||||
run_test("test_f32_s16d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_f32_to_s16d);
|
||||
true, false, conv_f32_to_s16d_c);
|
||||
run_test("test_f32d_s16d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_f32d_to_s16d);
|
||||
false, false, conv_f32d_to_s16d_c);
|
||||
}
|
||||
|
||||
static void test_s16_f32(void)
|
||||
|
|
@ -154,13 +154,13 @@ static void test_s16_f32(void)
|
|||
const float out[] = { 0.0f, 1.0f, -1.0f, 0.4999847412f, -0.4999847412f };
|
||||
|
||||
run_test("test_s16_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_s16_to_f32d);
|
||||
true, false, conv_s16_to_f32d_c);
|
||||
run_test("test_s16d_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_s16d_to_f32);
|
||||
false, true, conv_s16d_to_f32_c);
|
||||
run_test("test_s16_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_s16_to_f32);
|
||||
true, true, conv_s16_to_f32_c);
|
||||
run_test("test_s16d_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_s16d_to_f32d);
|
||||
false, false, conv_s16d_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s32(void)
|
||||
|
|
@ -170,13 +170,13 @@ static void test_f32_s32(void)
|
|||
0x7fffff00, 0x80000100 };
|
||||
|
||||
run_test("test_f32_s32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_f32_to_s32);
|
||||
true, true, conv_f32_to_s32_c);
|
||||
run_test("test_f32d_s32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_f32d_to_s32);
|
||||
false, true, conv_f32d_to_s32_c);
|
||||
run_test("test_f32_s32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_f32_to_s32d);
|
||||
true, false, conv_f32_to_s32d_c);
|
||||
run_test("test_f32d_s32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_f32d_to_s32d);
|
||||
false, false, conv_f32d_to_s32d_c);
|
||||
}
|
||||
|
||||
static void test_s32_f32(void)
|
||||
|
|
@ -185,13 +185,13 @@ static void test_s32_f32(void)
|
|||
const float out[] = { 0.0f, 1.0f, -1.0f, 0.4999999404f, -0.4999999404f, };
|
||||
|
||||
run_test("test_s32_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_s32_to_f32d);
|
||||
true, false, conv_s32_to_f32d_c);
|
||||
run_test("test_s32d_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_s32d_to_f32);
|
||||
false, true, conv_s32d_to_f32_c);
|
||||
run_test("test_s32_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_s32_to_f32);
|
||||
true, true, conv_s32_to_f32_c);
|
||||
run_test("test_s32d_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_s32d_to_f32d);
|
||||
false, false, conv_s32d_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s24(void)
|
||||
|
|
@ -201,13 +201,13 @@ static void test_f32_s24(void)
|
|||
0xff, 0xff, 0x3f, 0x01, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x80 };
|
||||
|
||||
run_test("test_f32_s24", in, sizeof(in[0]), out, 3, SPA_N_ELEMENTS(in),
|
||||
true, true, conv_f32_to_s24);
|
||||
true, true, conv_f32_to_s24_c);
|
||||
run_test("test_f32d_s24", in, sizeof(in[0]), out, 3, SPA_N_ELEMENTS(in),
|
||||
false, true, conv_f32d_to_s24);
|
||||
false, true, conv_f32d_to_s24_c);
|
||||
run_test("test_f32_s24d", in, sizeof(in[0]), out, 3, SPA_N_ELEMENTS(in),
|
||||
true, false, conv_f32_to_s24d);
|
||||
true, false, conv_f32_to_s24d_c);
|
||||
run_test("test_f32d_s24d", in, sizeof(in[0]), out, 3, SPA_N_ELEMENTS(in),
|
||||
false, false, conv_f32d_to_s24d);
|
||||
false, false, conv_f32d_to_s24d_c);
|
||||
}
|
||||
|
||||
static void test_s24_f32(void)
|
||||
|
|
@ -217,13 +217,13 @@ static void test_s24_f32(void)
|
|||
const float out[] = { 0.0f, 1.0f, -1.0f, 0.4999999404f, -0.4999999404f, };
|
||||
|
||||
run_test("test_s24_f32d", in, 3, out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_s24_to_f32d);
|
||||
true, false, conv_s24_to_f32d_c);
|
||||
run_test("test_s24d_f32", in, 3, out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_s24d_to_f32);
|
||||
false, true, conv_s24d_to_f32_c);
|
||||
run_test("test_s24_f32", in, 3, out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_s24_to_f32);
|
||||
true, true, conv_s24_to_f32_c);
|
||||
run_test("test_s24d_f32d", in, 3, out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_s24d_to_f32d);
|
||||
false, false, conv_s24d_to_f32d_c);
|
||||
}
|
||||
|
||||
static void test_f32_s24_32(void)
|
||||
|
|
@ -233,13 +233,13 @@ static void test_f32_s24_32(void)
|
|||
0x7fffff, 0xff800001 };
|
||||
|
||||
run_test("test_f32_s24_32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_f32_to_s24_32);
|
||||
true, true, conv_f32_to_s24_32_c);
|
||||
run_test("test_f32d_s24_32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_f32d_to_s24_32);
|
||||
false, true, conv_f32d_to_s24_32_c);
|
||||
run_test("test_f32_s24_32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_f32_to_s24_32d);
|
||||
true, false, conv_f32_to_s24_32d_c);
|
||||
run_test("test_f32d_s24_32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_f32d_to_s24_32d);
|
||||
false, false, conv_f32d_to_s24_32d_c);
|
||||
}
|
||||
|
||||
static void test_s24_32_f32(void)
|
||||
|
|
@ -248,13 +248,13 @@ static void test_s24_32_f32(void)
|
|||
const float out[] = { 0.0f, 1.0f, -1.0f, 0.4999999404f, -0.4999999404f, };
|
||||
|
||||
run_test("test_s24_32_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, false, conv_s24_32_to_f32d);
|
||||
true, false, conv_s24_32_to_f32d_c);
|
||||
run_test("test_s24_32d_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, true, conv_s24_32d_to_f32);
|
||||
false, true, conv_s24_32d_to_f32_c);
|
||||
run_test("test_s24_32_f32", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
true, true, conv_s24_32_to_f32);
|
||||
true, true, conv_s24_32_to_f32_c);
|
||||
run_test("test_s24_32d_f32d", in, sizeof(in[0]), out, sizeof(out[0]), SPA_N_ELEMENTS(out),
|
||||
false, false, conv_s24_32d_to_f32d);
|
||||
false, false, conv_s24_32d_to_f32d_c);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue