Skip to content

Commit

Permalink
Rewrote audio resampler using cubic filter interpolation
Browse files Browse the repository at this point in the history
This allows using a much smaller (1.5 KB) lookup table, in exchange for a small amount of extra work per frame.

The extra work (a few extra loads/mul/adds) is negligible, and can execute in parallel.
The reduction in cache misses almost certainly outweighs any added cost.

The table is generated at runtime, and takes less than 0.02ms on my computer.
  • Loading branch information
0x1F9F1 authored and slouken committed Apr 15, 2024
1 parent 46cecc4 commit 8f6f9ca
Show file tree
Hide file tree
Showing 5 changed files with 481 additions and 817 deletions.
4 changes: 0 additions & 4 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Expand Up @@ -391,7 +391,6 @@
F32DDACF2AB795A30041EAA5 /* SDL_audio_channel_converters.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DDAC92AB795A30041EAA5 /* SDL_audio_channel_converters.h */; };
F32DDAD02AB795A30041EAA5 /* SDL_audioresample.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DDACA2AB795A30041EAA5 /* SDL_audioresample.h */; };
F32DDAD12AB795A30041EAA5 /* SDL_audioqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = F32DDACB2AB795A30041EAA5 /* SDL_audioqueue.c */; };
F32DDAD22AB795A30041EAA5 /* SDL_audio_resampler_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DDACC2AB795A30041EAA5 /* SDL_audio_resampler_filter.h */; };
F32DDAD32AB795A30041EAA5 /* SDL_audioqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DDACD2AB795A30041EAA5 /* SDL_audioqueue.h */; };
F32DDAD42AB795A30041EAA5 /* SDL_audioresample.c in Sources */ = {isa = PBXBuildFile; fileRef = F32DDACE2AB795A30041EAA5 /* SDL_audioresample.c */; };
F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; };
Expand Down Expand Up @@ -916,7 +915,6 @@
F32DDAC92AB795A30041EAA5 /* SDL_audio_channel_converters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_channel_converters.h; sourceTree = "<group>"; };
F32DDACA2AB795A30041EAA5 /* SDL_audioresample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audioresample.h; sourceTree = "<group>"; };
F32DDACB2AB795A30041EAA5 /* SDL_audioqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audioqueue.c; sourceTree = "<group>"; };
F32DDACC2AB795A30041EAA5 /* SDL_audio_resampler_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_resampler_filter.h; sourceTree = "<group>"; };
F32DDACD2AB795A30041EAA5 /* SDL_audioqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audioqueue.h; sourceTree = "<group>"; };
F32DDACE2AB795A30041EAA5 /* SDL_audioresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audioresample.c; sourceTree = "<group>"; };
F362B9152B3349E200D30B94 /* controller_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_list.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1982,7 +1980,6 @@
A7D8A87023E2513F00DCD162 /* dummy */,
A7D8A87323E2513F00DCD162 /* SDL_audio_c.h */,
F32DDAC92AB795A30041EAA5 /* SDL_audio_channel_converters.h */,
F32DDACC2AB795A30041EAA5 /* SDL_audio_resampler_filter.h */,
A7D8A8B823E2513F00DCD162 /* SDL_audio.c */,
A7D8A8A123E2513F00DCD162 /* SDL_audiocvt.c */,
A7D8A87723E2513F00DCD162 /* SDL_audiodev_c.h */,
Expand Down Expand Up @@ -2295,7 +2292,6 @@
F3F7D8ED2933074E00816151 /* SDL_audio.h in Headers */,
A7D8B7A023E2514400DCD162 /* SDL_audio_c.h in Headers */,
F32DDACF2AB795A30041EAA5 /* SDL_audio_channel_converters.h in Headers */,
F32DDAD22AB795A30041EAA5 /* SDL_audio_resampler_filter.h in Headers */,
A7D8B7B223E2514400DCD162 /* SDL_audiodev_c.h in Headers */,
F32DDAD32AB795A30041EAA5 /* SDL_audioqueue.h in Headers */,
F32DDAD02AB795A30041EAA5 /* SDL_audioresample.h in Headers */,
Expand Down
149 changes: 0 additions & 149 deletions build-scripts/gen_audio_resampler_filter.c

This file was deleted.

0 comments on commit 8f6f9ca

Please sign in to comment.