src/audio/SDL_audiocvt.c


Log

Author Commit Date CI Message
Ryan C. Gordon 47e2f4e9 2017-01-24T20:30:48 audio: libsamplerate can't resample in-place; make space for a copy if needed.
Ryan C. Gordon c7f9dcb6 2017-01-24T15:52:22 audio: Offer a hint for libsamplerate quality/speed tradeoff. This defaults to the internal SDL resampler, since that's the likely default without a system-wide install of libsamplerate, but those that need more can tweak this.
Ryan C. Gordon 1da3a337 2017-01-24T10:09:29 audio: Fix static analysis concerns about a dead assignment.
Ryan C. Gordon 8f627c1c 2017-01-24T00:51:33 audio: Make sure SDL_AudioStream's work buffer is 16-byte aligned, for SIMD. Note the giantic FIXME, though!
Ryan C. Gordon 17dcee20 2017-01-24T00:17:40 audio: Streams now resample in-place. Removed second allocated buffer.
Ryan C. Gordon b5eeab77 2017-01-24T00:08:24 audio: allow stereo Sint16 resampling fast path in SDL_AudioStream. This currently favors libsamplerate over the fast path (quality over speed), but I'm not sure that's the correct approach, as there may be surprising changes in performance metrics depending on what packages are available on a user's system. That being said, currently, the only thing with access to SDL_AudioStream is an SDL audio device's thread, and it might be mostly idle otherwise, so maybe this is generally good.
Ryan C. Gordon a80cb672 2017-01-24T00:03:36 audio: Fixed off-by-one error in upsampling.
Ryan C. Gordon dad07f96 2017-01-23T16:45:50 audio: Resampler now special-cases stereo and mono processing. Turns out that iterating from 0 to channels-1 was a serious performance hit! These cases now tend to match or beat the original audio resampler's speed!
Ryan C. Gordon 8ce6ddf1 2017-01-23T16:42:47 audio: Fixed incorrect pointer in SDL_ResampleCVT_si16_c2(). Forgot to update this when we changed this to process in-place. Whoops!
Ryan C. Gordon 3594bf8e 2017-01-23T01:05:44 audio: Wired up new SSE code to build system.
Ryan C. Gordon 64056e81 2017-01-23T00:57:19 audio: Added SSE3 implementation of SDL_ConvertStereoToMono().
Ryan C. Gordon 8855daac 2017-01-22T23:48:15 audio: Make the simple resampler operate in-place. This allows us to avoid an extra copy, allocate less memory and reduce cache pressure. On the downside: we have to do a lot of tapdancing to resample the buffer in reverse when the output is growing.
Ryan C. Gordon 202ab30c 2017-01-22T20:27:48 audio: Special case for resampling stereo AUDIO_S16SYS audio data. This is a fairly common case, so we avoid the conversion to/from float here.
Ryan C. Gordon a7f86f2f 2017-01-22T20:18:59 audio: don't cast to double in SDL_ConvertStereoToMono(). It's expensive and (hopefully) unnecessary. If this becomes an overflow problem, we could multiply both values by 0.5f before adding them, but let's see if we can get by without the extra multiplication first.
Ryan C. Gordon 83454c82 2017-01-20T16:26:24 audio: removed conditional from simple resampler's inner loop. We never seem to overflow the source buffer now; this might have been a leftover from a bug that was covered by Vitaly's fixes? Removing this conditional makes the resampler 10-20% faster. Left an assert in there for debug builds, in case this still happens.
Ryan C. Gordon 3e1679c8 2017-01-18T02:11:56 audio: Several fixes to "simple" resampler (thanks, Vitaly!). Fixes Bugzilla #3551.
Ryan C. Gordon 1e66d457 2017-01-15T05:01:59 audio: Some fixes to the audio data type converter code. Removed some needless things ("len / sizeof (Uint8)"), and made sure the int32 -> float code uses doubles to avoid working with large integer values in a 32-bit float.
Sam Lantinga bf11cd50 2017-01-09T20:37:52 Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC Lukasz Biel Tried to compile SDL2 using newest version of VS. Got: SDL_audiocvt.obj : error LNK2019: unresolved external symbol memcpy referenced in function SDL_ResampleCVT 1>E:\Users\dotPo\Lib\SDL\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals whole compilation process: http://pastebin.com/eWDAvBce Steps to reproduce: clone http://hg.libsdl.org/SDL using tortoise hg, open SDL\VisualC\SDL.sln, when promted if should retarget solution click ok, select release x64 build type, Build/Build Solution attempt 2, using Visual Studio cmake support: open folder SDL\ select release x64 build type, run CMake\Build CMakeLists.txt build fails When switched to debug build type, buils succeeds in both cases. VS 2017 is still beta.
Ryan C. Gordon 23020f92 2017-01-09T16:31:57 audio: Don't ever use libsamplerate in the SDL_AudioCVT codepath. It causes audio pops if you're converting in chunks (and needs to allocate/initialize/free on each convert). We'll either adjust this interface when we break ABI for 2.1 to make this usable, or publish the SDL_AudioStream API for those that want a streaming solution. In the meantime, the "simple" resampler produces "good enough" audio without pops and doesn't have to be initialized, so that'll do for now on the SDL_AudioCVT interface.
Ryan C. Gordon 063c9d40 2017-01-09T06:00:58 audio: Replaced older resamplers in SDL_AudioCVT with the new ones.
Ryan C. Gordon 38854e03 2017-01-08T16:18:49 audio: Improvements in channel conversion code.
Ryan C. Gordon d005dc21 2017-01-08T14:23:15 audio: Patched to compile with libsamplerate support.
Ryan C. Gordon 19e937fc 2017-01-08T14:18:03 audio: libsamplerate loading now happens once at init time.
Ryan C. Gordon 98cc9d10 2017-01-08T14:17:09 Fixed coding style on a function signature.
Sam Lantinga df25258a 2017-01-06T20:43:53 Added configure and cmake support for libsamplerate
Ryan C. Gordon c5825b69 2017-01-06T21:23:51 audio: Don't call a NULL function pointer when clearing audio streams. (Partially?) fixes Bugzilla #3547.
Sam Lantinga cbe44f7f 2017-01-06T02:16:26 Added support for using libsamplerate to do audio resampling
Sam Lantinga 3443dc19 2017-01-05T23:53:46 Don't do any audio conversion if none is necessary
Ryan C. Gordon 992124d4 2017-01-06T01:02:58 audio: Fixed SDL_AudioStreamGet() function parameters. There was a draft of this where it did audio conversion into the final buffer, if there was enough room available past what you asked for, but that interface got removed, so the parameters didn't make sense (and we were using the wrong one in any case, too!).
Ryan C. Gordon 3761b5f6 2017-01-05T20:11:19 Fixed a few compiler warnings.
Ryan C. Gordon 30178a9b 2017-01-05T19:29:38 audio: Added SDL_AudioStream. Non-power-of-two resampling now works!
Ryan C. Gordon f12ab8f2 2017-01-05T19:12:20 audio: More effort to improve and simplify audio resamplers.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Philipp Wiesemann 6380d5c2 2016-11-07T21:10:01 Fixed audio conversion for unsigned 16 bit data.
Sam Lantinga 6ed82130 2016-11-05T01:52:28 Fixed Windows build
Ryan C. Gordon a17abf10 2016-11-05T03:56:55 Also patched to compile on C89 compilers.
Ryan C. Gordon 067f0c84 2016-11-05T03:53:59 Patched to compile on C89 compilers.
Ryan C. Gordon f3456e9a 2016-11-05T02:34:38 Reworked audio converter code. This no longer uses a script to generate code for every possible type conversion or resampler. This caused a bloat in binary size and and compile times. Now we use a handful of more generic functions and assume staying in the CPU cache is the most important thing anyhow. This shrinks the size of the final build (in this case: macOS X amd64, -Os to optimize for size) by 15%. When compiling on a single core, build times drop by about 15% too (although the previous cost was largely hidden by multicore builds).
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().