Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
40abbc8d
Commit
40abbc8d
authored
May 29, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plug SIMD-optimized conversion routines into mal_format_converter.
parent
dba80816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
415 additions
and
44 deletions
+415
-44
mini_al.h
mini_al.h
+415
-44
No files found.
mini_al.h
View file @
40abbc8d
...
@@ -19147,84 +19147,68 @@ void mal_pcm_deinterleave_f32(void** dst, const void* src, mal_uint64 frameCount
...
@@ -19147,84 +19147,68 @@ void mal_pcm_deinterleave_f32(void** dst, const void* src, mal_uint64 frameCount
}
}
void mal_format_converter_init_callbacks__default(mal_format_converter* pConverter)
mal_result mal_format_converter_init(const mal_format_converter_config* pConfig, mal_format_converter* pConverter)
{
{
if (pConverter == NULL) {
mal_assert(pConverter != NULL);
return MAL_INVALID_ARGS;
}
mal_zero_object(pConverter);
if (pConfig == NULL) {
return MAL_INVALID_ARGS;
}
pConverter->config = *pConfig;
// SIMD
pConverter->useSSE2 = mal_has_sse2() && !pConfig->noSSE2;
pConverter->useAVX2 = mal_has_avx2() && !pConfig->noAVX2;
pConverter->useAVX512 = mal_has_avx512f() && !pConfig->noAVX512;
pConverter->useNEON = mal_has_neon() && !pConfig->noNEON;
switch (pCon
fig->
formatIn)
switch (pCon
verter->config.
formatIn)
{
{
case mal_format_u8:
case mal_format_u8:
{
{
if (pCon
fig->
formatOut == mal_format_u8) {
if (pCon
verter->config.
formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
} else if (pCon
fig->
formatOut == mal_format_s16) {
} else if (pCon
verter->config.
formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_u8_to_s16;
pConverter->onConvertPCM = mal_pcm_u8_to_s16;
} else if (pCon
fig->
formatOut == mal_format_s24) {
} else if (pCon
verter->config.
formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_u8_to_s24;
pConverter->onConvertPCM = mal_pcm_u8_to_s24;
} else if (pCon
fig->
formatOut == mal_format_s32) {
} else if (pCon
verter->config.
formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_u8_to_s32;
pConverter->onConvertPCM = mal_pcm_u8_to_s32;
} else if (pCon
fig->
formatOut == mal_format_f32) {
} else if (pCon
verter->config.
formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_u8_to_f32;
pConverter->onConvertPCM = mal_pcm_u8_to_f32;
}
}
} break;
} break;
case mal_format_s16:
case mal_format_s16:
{
{
if (pCon
fig->
formatOut == mal_format_u8) {
if (pCon
verter->config.
formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s16_to_u8;
pConverter->onConvertPCM = mal_pcm_s16_to_u8;
} else if (pCon
fig->
formatOut == mal_format_s16) {
} else if (pCon
verter->config.
formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
} else if (pCon
fig->
formatOut == mal_format_s24) {
} else if (pCon
verter->config.
formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s16_to_s24;
pConverter->onConvertPCM = mal_pcm_s16_to_s24;
} else if (pCon
fig->
formatOut == mal_format_s32) {
} else if (pCon
verter->config.
formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s16_to_s32;
pConverter->onConvertPCM = mal_pcm_s16_to_s32;
} else if (pCon
fig->
formatOut == mal_format_f32) {
} else if (pCon
verter->config.
formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s16_to_f32;
pConverter->onConvertPCM = mal_pcm_s16_to_f32;
}
}
} break;
} break;
case mal_format_s24:
case mal_format_s24:
{
{
if (pCon
fig->
formatOut == mal_format_u8) {
if (pCon
verter->config.
formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s24_to_u8;
pConverter->onConvertPCM = mal_pcm_s24_to_u8;
} else if (pCon
fig->
formatOut == mal_format_s16) {
} else if (pCon
verter->config.
formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s24_to_s16;
pConverter->onConvertPCM = mal_pcm_s24_to_s16;
} else if (pCon
fig->
formatOut == mal_format_s24) {
} else if (pCon
verter->config.
formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
} else if (pCon
fig->
formatOut == mal_format_s32) {
} else if (pCon
verter->config.
formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s24_to_s32;
pConverter->onConvertPCM = mal_pcm_s24_to_s32;
} else if (pCon
fig->
formatOut == mal_format_f32) {
} else if (pCon
verter->config.
formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s24_to_f32;
pConverter->onConvertPCM = mal_pcm_s24_to_f32;
}
}
} break;
} break;
case mal_format_s32:
case mal_format_s32:
{
{
if (pCon
fig->
formatOut == mal_format_u8) {
if (pCon
verter->config.
formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s32_to_u8;
pConverter->onConvertPCM = mal_pcm_s32_to_u8;
} else if (pCon
fig->
formatOut == mal_format_s16) {
} else if (pCon
verter->config.
formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s32_to_s16;
pConverter->onConvertPCM = mal_pcm_s32_to_s16;
} else if (pCon
fig->
formatOut == mal_format_s24) {
} else if (pCon
verter->config.
formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s32_to_s24;
pConverter->onConvertPCM = mal_pcm_s32_to_s24;
} else if (pCon
fig->
formatOut == mal_format_s32) {
} else if (pCon
verter->config.
formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
} else if (pCon
fig->
formatOut == mal_format_f32) {
} else if (pCon
verter->config.
formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s32_to_f32;
pConverter->onConvertPCM = mal_pcm_s32_to_f32;
}
}
} break;
} break;
...
@@ -19232,20 +19216,407 @@ mal_result mal_format_converter_init(const mal_format_converter_config* pConfig,
...
@@ -19232,20 +19216,407 @@ mal_result mal_format_converter_init(const mal_format_converter_config* pConfig,
case mal_format_f32:
case mal_format_f32:
default:
default:
{
{
if (pCon
fig->
formatOut == mal_format_u8) {
if (pCon
verter->config.
formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_f32_to_u8;
pConverter->onConvertPCM = mal_pcm_f32_to_u8;
} else if (pCon
fig->
formatOut == mal_format_s16) {
} else if (pCon
verter->config.
formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_f32_to_s16;
pConverter->onConvertPCM = mal_pcm_f32_to_s16;
} else if (pCon
fig->
formatOut == mal_format_s24) {
} else if (pCon
verter->config.
formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_f32_to_s24;
pConverter->onConvertPCM = mal_pcm_f32_to_s24;
} else if (pCon
fig->
formatOut == mal_format_s32) {
} else if (pCon
verter->config.
formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_f32_to_s32;
pConverter->onConvertPCM = mal_pcm_f32_to_s32;
} else if (pConfig->formatOut == mal_format_f32) {
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
}
} break;
}
}
#if defined(MAL_SUPPORT_SSE2)
void mal_format_converter_init_callbacks__sse2(mal_format_converter* pConverter)
{
mal_assert(pConverter != NULL);
switch (pConverter->config.formatIn)
{
case mal_format_u8:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_u8_to_s16__sse2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_u8_to_s24__sse2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_u8_to_s32__sse2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_u8_to_f32__sse2;
}
} break;
case mal_format_s16:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s16_to_u8__sse2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s16_to_s24__sse2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s16_to_s32__sse2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s16_to_f32__sse2;
}
} break;
case mal_format_s24:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s24_to_u8__sse2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s24_to_s16__sse2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s24_to_s32__sse2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s24_to_f32__sse2;
}
} break;
case mal_format_s32:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s32_to_u8__sse2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s32_to_s16__sse2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s32_to_s24__sse2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s32_to_f32__sse2;
}
} break;
case mal_format_f32:
default:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_f32_to_u8__sse2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_f32_to_s16__sse2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_f32_to_s24__sse2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_f32_to_s32__sse2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
}
} break;
}
}
#endif
#if defined(MAL_SUPPORT_AVX2)
void mal_format_converter_init_callbacks__avx2(mal_format_converter* pConverter)
{
mal_assert(pConverter != NULL);
switch (pConverter->config.formatIn)
{
case mal_format_u8:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_u8_to_s16__avx2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_u8_to_s24__avx2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_u8_to_s32__avx2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_u8_to_f32__avx2;
}
} break;
case mal_format_s16:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s16_to_u8__avx2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s16_to_s24__avx2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s16_to_s32__avx2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s16_to_f32__avx2;
}
} break;
case mal_format_s24:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s24_to_u8__avx2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s24_to_s16__avx2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s24_to_s32__avx2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s24_to_f32__avx2;
}
} break;
case mal_format_s32:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s32_to_u8__avx2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s32_to_s16__avx2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s32_to_s24__avx2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s32_to_f32__avx2;
}
} break;
case mal_format_f32:
default:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_f32_to_u8__avx2;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_f32_to_s16__avx2;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_f32_to_s24__avx2;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_f32_to_s32__avx2;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
}
} break;
}
}
#endif
#if defined(MAL_SUPPORT_AVX512)
void mal_format_converter_init_callbacks__avx512(mal_format_converter* pConverter)
{
mal_assert(pConverter != NULL);
switch (pConverter->config.formatIn)
{
case mal_format_u8:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_u8_to_s16__avx512;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_u8_to_s24__avx512;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_u8_to_s32__avx512;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_u8_to_f32__avx512;
}
} break;
case mal_format_s16:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s16_to_u8__avx512;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s16_to_s24__avx512;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s16_to_s32__avx512;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s16_to_f32__avx512;
}
} break;
case mal_format_s24:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s24_to_u8__avx512;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s24_to_s16__avx512;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s24_to_s32__avx512;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s24_to_f32__avx512;
}
} break;
case mal_format_s32:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s32_to_u8__avx512;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s32_to_s16__avx512;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s32_to_s24__avx512;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s32_to_f32__avx512;
}
} break;
case mal_format_f32:
default:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_f32_to_u8__avx512;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_f32_to_s16__avx512;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_f32_to_s24__avx512;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_f32_to_s32__avx512;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
}
} break;
}
}
#endif
#if defined(MAL_SUPPORT_NEON)
void mal_format_converter_init_callbacks__neon(mal_format_converter* pConverter)
{
mal_assert(pConverter != NULL);
switch (pConverter->config.formatIn)
{
case mal_format_u8:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_u8_to_u8;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_u8_to_s16__neon;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_u8_to_s24__neon;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_u8_to_s32__neon;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_u8_to_f32__neon;
}
} break;
case mal_format_s16:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s16_to_u8__neon;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s16_to_s16;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s16_to_s24__neon;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s16_to_s32__neon;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s16_to_f32__neon;
}
} break;
case mal_format_s24:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s24_to_u8__neon;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s24_to_s16__neon;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s24_to_s24;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s24_to_s32__neon;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s24_to_f32__neon;
}
} break;
case mal_format_s32:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_s32_to_u8__neon;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_s32_to_s16__neon;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_s32_to_s24__neon;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_s32_to_s32;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_s32_to_f32__neon;
}
} break;
case mal_format_f32:
default:
{
if (pConverter->config.formatOut == mal_format_u8) {
pConverter->onConvertPCM = mal_pcm_f32_to_u8__neon;
} else if (pConverter->config.formatOut == mal_format_s16) {
pConverter->onConvertPCM = mal_pcm_f32_to_s16__neon;
} else if (pConverter->config.formatOut == mal_format_s24) {
pConverter->onConvertPCM = mal_pcm_f32_to_s24__neon;
} else if (pConverter->config.formatOut == mal_format_s32) {
pConverter->onConvertPCM = mal_pcm_f32_to_s32__neon;
} else if (pConverter->config.formatOut == mal_format_f32) {
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
pConverter->onConvertPCM = mal_pcm_f32_to_f32;
}
}
} break;
} break;
}
}
}
#endif
mal_result mal_format_converter_init(const mal_format_converter_config* pConfig, mal_format_converter* pConverter)
{
if (pConverter == NULL) {
return MAL_INVALID_ARGS;
}
mal_zero_object(pConverter);
if (pConfig == NULL) {
return MAL_INVALID_ARGS;
}
pConverter->config = *pConfig;
// SIMD
pConverter->useSSE2 = mal_has_sse2() && !pConfig->noSSE2;
pConverter->useAVX2 = mal_has_avx2() && !pConfig->noAVX2;
pConverter->useAVX512 = mal_has_avx512f() && !pConfig->noAVX512;
pConverter->useNEON = mal_has_neon() && !pConfig->noNEON;
#if defined(MAL_SUPPORT_AVX512)
if (pConverter->useAVX512) {
mal_format_converter_init_callbacks__avx512(pConverter);
} else
#endif
#if defined(MAL_SUPPORT_AVX2)
if (pConverter->useAVX2) {
mal_format_converter_init_callbacks__avx2(pConverter);
} else
#endif
#if defined(MAL_SUPPORT_SSE2)
if (pConverter->useSSE2) {
mal_format_converter_init_callbacks__sse2(pConverter);
} else
#endif
#if defined(MAL_SUPPORT_NEON)
if (pConverter->useNEON) {
mal_format_converter_init_callbacks__neon(pConverter);
} else
#endif
{
mal_format_converter_init_callbacks__default(pConverter);
}
switch (pConfig->formatOut)
switch (pConfig->formatOut)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment