Commit 7701dc4e authored by David Reid's avatar David Reid

Update test and build files.

parent 211c069b
#define MAL_IMPLEMENTATION
#include "../mini_al.h"
int do_profiling__channel_routing()
{
}
int main(int argc, char** argv)
{
(void)argc;
(void)argv;
// Channel routing.
do_profiling__channel_routing();
return 0;
}
\ No newline at end of file
......@@ -308,7 +308,7 @@ int mal_pcm_compare(const void* a, const void* b, mal_uint64 count, mal_format f
mal_uint8 sampleB = b_u8[i];
if (sampleA != sampleB) {
if (abs(sampleA - sampleB) > allowedDifference) { // Allow a difference of 1.
printf("Sample %I64u not equal. %d != %d (diff: %d)\n", i, sampleA, sampleB, sampleA - sampleB);
printf("Sample %u not equal. %d != %d (diff: %d)\n", (mal_int32)i, sampleA, sampleB, sampleA - sampleB);
result = -1;
}
}
......@@ -320,7 +320,7 @@ int mal_pcm_compare(const void* a, const void* b, mal_uint64 count, mal_format f
mal_int16 sampleB = b_s16[i];
if (sampleA != sampleB) {
if (abs(sampleA - sampleB) > allowedDifference) { // Allow a difference of 1.
printf("Sample %I64u not equal. %d != %d (diff: %d)\n", i, sampleA, sampleB, sampleA - sampleB);
printf("Sample %u not equal. %d != %d (diff: %d)\n", (mal_int32)i, sampleA, sampleB, sampleA - sampleB);
result = -1;
}
}
......@@ -332,7 +332,7 @@ int mal_pcm_compare(const void* a, const void* b, mal_uint64 count, mal_format f
mal_int32 sampleB = ((mal_int32)(((mal_uint32)(b_u8[i*3+0]) << 8) | ((mal_uint32)(b_u8[i*3+1]) << 16) | ((mal_uint32)(b_u8[i*3+2])) << 24)) >> 8;
if (sampleA != sampleB) {
if (abs(sampleA - sampleB) > allowedDifference) { // Allow a difference of 1.
printf("Sample %I64u not equal. %d != %d (diff: %d)\n", i, sampleA, sampleB, sampleA - sampleB);
printf("Sample %u not equal. %d != %d (diff: %d)\n", (mal_int32)i, sampleA, sampleB, sampleA - sampleB);
result = -1;
}
}
......@@ -344,7 +344,7 @@ int mal_pcm_compare(const void* a, const void* b, mal_uint64 count, mal_format f
mal_int32 sampleB = b_s32[i];
if (sampleA != sampleB) {
if (abs(sampleA - sampleB) > allowedDifference) { // Allow a difference of 1.
printf("Sample %I64u not equal. %d != %d (diff: %d)\n", i, sampleA, sampleB, sampleA - sampleB);
printf("Sample %u not equal. %d != %d (diff: %d)\n", (mal_int32)i, sampleA, sampleB, sampleA - sampleB);
result = -1;
}
}
......@@ -359,7 +359,7 @@ int mal_pcm_compare(const void* a, const void* b, mal_uint64 count, mal_format f
difference = (difference < 0) ? -difference : difference;
if (difference > allowedDifference) {
printf("Sample %I64u not equal. %.8f != %.8f (diff: %.8f)\n", i, sampleA, sampleB, sampleA - sampleB);
printf("Sample %u not equal. %.8f != %.8f (diff: %.8f)\n", (mal_int32)i, sampleA, sampleB, sampleA - sampleB);
result = -1;
}
}
......@@ -599,7 +599,7 @@ int do_format_conversion_test(mal_format formatIn, mal_format formatOut)
void* pBenchmarkData = load_raw_audio_data(pBenchmarkFilePath, formatOut, &benchmarkFrameCount);
if (pBenchmarkData != NULL) {
if (benchmarkFrameCount == baseFrameCount) {
void* pConvertedData = (void*)mal_malloc(benchmarkFrameCount * mal_get_bytes_per_sample(formatOut));
void* pConvertedData = (void*)mal_malloc((size_t)benchmarkFrameCount * mal_get_bytes_per_sample(formatOut));
if (pConvertedData != NULL) {
onConvertPCM(pConvertedData, pBaseData, (mal_uint32)benchmarkFrameCount, mal_dither_mode_none);
result = mal_pcm_compare(pBenchmarkData, pConvertedData, benchmarkFrameCount, formatOut, allowedDifference);
......@@ -1178,7 +1178,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(interleavedFrames, sizeof(mal_int16), framesRead * converter.config.channels, pFile);
fwrite(interleavedFrames, sizeof(mal_int16), (size_t)framesRead * converter.config.channels, pFile);
fclose(pFile);
}
......@@ -1214,7 +1214,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(ppDeinterleavedFrames[iChannel], sizeof(mal_int16), framesRead, pFile);
fwrite(ppDeinterleavedFrames[iChannel], sizeof(mal_int16), (size_t)framesRead, pFile);
fclose(pFile);
}
}
......@@ -1245,7 +1245,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(interleavedFrames, sizeof(mal_int16), framesRead * converter.config.channels, pFile);
fwrite(interleavedFrames, sizeof(mal_int16), (size_t)framesRead * converter.config.channels, pFile);
fclose(pFile);
}
......@@ -1281,7 +1281,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(ppDeinterleavedFrames[iChannel], sizeof(mal_int16), framesRead, pFile);
fwrite(ppDeinterleavedFrames[iChannel], sizeof(mal_int16), (size_t)framesRead, pFile);
fclose(pFile);
}
}
......@@ -1313,7 +1313,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(interleavedFrames, sizeof(float), framesRead * converter.config.channels, pFile);
fwrite(interleavedFrames, sizeof(float), (size_t)framesRead * converter.config.channels, pFile);
fclose(pFile);
}
......@@ -1349,7 +1349,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(ppDeinterleavedFrames[iChannel], sizeof(float), framesRead, pFile);
fwrite(ppDeinterleavedFrames[iChannel], sizeof(float), (size_t)framesRead, pFile);
fclose(pFile);
}
}
......@@ -1380,7 +1380,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(interleavedFrames, sizeof(float), framesRead * converter.config.channels, pFile);
fwrite(interleavedFrames, sizeof(float), (size_t)framesRead * converter.config.channels, pFile);
fclose(pFile);
}
......@@ -1416,7 +1416,7 @@ int do_format_converter_tests()
return -1;
}
fwrite(ppDeinterleavedFrames[iChannel], sizeof(float), framesRead, pFile);
fwrite(ppDeinterleavedFrames[iChannel], sizeof(float), (size_t)framesRead, pFile);
fclose(pFile);
}
}
......@@ -1486,11 +1486,11 @@ int do_channel_routing_tests()
// Here is where we check that the passthrough optimization works correctly. What we do is compare the output of the passthrough
// optimization with the non-passthrough output. We don't use a real sound here, but instead use values that makes it easier for
// us to check results. Each channel is given a value equal to it's index, plus 1.
float testData[MAL_MAX_CHANNELS][100];
float testData[MAL_MAX_CHANNELS][MAL_SIMD_ALIGNMENT * 2];
float* ppTestData[MAL_MAX_CHANNELS];
for (mal_uint32 iChannel = 0; iChannel < routerConfig.channelsIn; ++iChannel) {
ppTestData[iChannel] = testData[iChannel];
for (mal_uint32 iFrame = 0; iFrame < 100; ++iFrame) {
for (mal_uint32 iFrame = 0; iFrame < mal_countof(testData[0]); ++iFrame) {
ppTestData[iChannel][iFrame] = (float)(iChannel + 1);
}
}
......@@ -1498,8 +1498,8 @@ int do_channel_routing_tests()
routerConfig.pUserData = ppTestData;
mal_channel_router_init(&routerConfig, &router);
float outputA[MAL_MAX_CHANNELS][100];
float outputB[MAL_MAX_CHANNELS][100];
MAL_ALIGN(MAL_SIMD_ALIGNMENT) float outputA[MAL_MAX_CHANNELS][MAL_SIMD_ALIGNMENT * 2];
MAL_ALIGN(MAL_SIMD_ALIGNMENT) float outputB[MAL_MAX_CHANNELS][MAL_SIMD_ALIGNMENT * 2];
float* ppOutputA[MAL_MAX_CHANNELS];
float* ppOutputB[MAL_MAX_CHANNELS];
for (mal_uint32 iChannel = 0; iChannel < routerConfig.channelsOut; ++iChannel) {
......@@ -1508,8 +1508,8 @@ int do_channel_routing_tests()
}
// With optimizations.
mal_uint64 framesRead = mal_channel_router_read_deinterleaved(&router, 100, (void**)ppOutputA, router.config.pUserData);
if (framesRead != 100) {
mal_uint64 framesRead = mal_channel_router_read_deinterleaved(&router, mal_countof(outputA[0]), (void**)ppOutputA, router.config.pUserData);
if (framesRead != mal_countof(outputA[0])) {
printf("Returned frame count for optimized incorrect.");
hasError = MAL_TRUE;
}
......@@ -1517,15 +1517,15 @@ int do_channel_routing_tests()
// Without optimizations.
router.isPassthrough = MAL_FALSE;
router.isSimpleShuffle = MAL_FALSE;
framesRead = mal_channel_router_read_deinterleaved(&router, 100, (void**)ppOutputB, router.config.pUserData);
if (framesRead != 100) {
framesRead = mal_channel_router_read_deinterleaved(&router, mal_countof(outputA[0]), (void**)ppOutputB, router.config.pUserData);
if (framesRead != mal_countof(outputA[0])) {
printf("Returned frame count for unoptimized path incorrect.");
hasError = MAL_TRUE;
}
// Compare.
for (mal_uint32 iChannel = 0; iChannel < routerConfig.channelsOut; ++iChannel) {
for (mal_uint32 iFrame = 0; iFrame < 100; ++iFrame) {
for (mal_uint32 iFrame = 0; iFrame < mal_countof(outputA[0]); ++iFrame) {
if (ppOutputA[iChannel][iFrame] != ppOutputB[iChannel][iFrame]) {
printf("Sample incorrect [%d][%d]\n", iChannel, iFrame);
hasError = MAL_TRUE;
......
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
......@@ -31,6 +39,12 @@
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
......@@ -38,6 +52,13 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
......@@ -59,9 +80,15 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
......@@ -75,6 +102,11 @@
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>C:\dev-other\SDL2-2.0.3\lib\x86;C:\dev-other\openal-soft-1.16.0-bin\libs\Win32;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>C:\dev-other\SDL2-2.0.3\lib\x86;C:\dev-other\openal-soft-1.16.0-bin\libs\Win32;$(LibraryPath)</LibraryPath>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>../../../mal/</OutDir>
......@@ -86,6 +118,11 @@
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>C:\dev-other\SDL2-2.0.3\lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>C:\dev-other\SDL2-2.0.3\lib\x86;$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>../../../mal/</OutDir>
......@@ -102,6 +139,28 @@
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<CompileAs>Default</CompileAs>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<CompileAs>Default</CompileAs>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -141,6 +200,31 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>
</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
......@@ -174,15 +258,27 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mal_profiling.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mal_test_0.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mal_test_0.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
......
......@@ -21,6 +21,9 @@
<ClCompile Include="mal_test_0.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="mal_profiling.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\mini_al.h">
......
#!/bin/bash
cc mal_test_0.c -o ./bin/mal_test_0 -Wall -ldl -lpthread
c++ mal_test_0.cpp -o ./bin/mal_test_0_cpp -Wall -ldl -lpthread
\ No newline at end of file
cc mal_test_0.c -o ./bin/mal_test_0 -Wall -ldl -lpthread -lm
c++ mal_test_0.cpp -o ./bin/mal_test_0_cpp -Wall -ldl -lpthread -lm
\ No newline at end of file
gcc mal_test_0.c -o bin/mal_test_0.exe -Wall
g++ mal_test_0.cpp -o bin/mal_test_0_cpp.exe -Wall
\ No newline at end of file
gcc mal_test_0.c -o bin/mal_test_0.exe -Wall -mavx
g++ mal_test_0.cpp -o bin/mal_test_0_cpp.exe -Wall -mavx
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment