summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2013-12-15DSP Compressor: Sidechain, Exponential Atk/RlsRyan Billing2-88/+292
This is an improvement to the current compressor which I have added to my own Sansa Fuze V2 build. I am submitting here in case others find it interesting. Features added to the existing compressor: Attack, Look-ahead, Sidechain Filtering. Exponential attack and release characteristic response. Benefits from adding missing features: Attack: Preserve perceived "brightness" of tone by letting onset transients come through at a higher level than the rest of the compressed program material. Look-ahead: With Attack comes clipping on the leading several cycles of a transient onset. With look-ahead function, this can be pre-emptively mitigated with a slower gain change (less distortion). Look-ahead limiting is implemented to prevent clipping while keeping gain change ramp to an interval near 3ms instead of instant attack. The existing compressor implementation distorts the leading edge of a transient by causing instant gain change, resulting in log() distortion. This sounds "woofy" to me. Exponential Attack/Release: eMore natural sounding. On attack, this is a true straight line of 10dB per attack interval. Release is a little different, however, sounds natural as an analog compressor. Sidechain Filtering: Mild high-pass filter reduces response to low frequency onsets. For example, a hard kick drum is less likely to make the whole of the program material appear to fade in and out. Combined with a moderate attack time, such a transient will ride through with minimal audible artifact. Overall these changes make dynamic music sound more "open", more natural. The goal of a compressor is to make dyanamic music sound louder without necessarily sounding as though it has been compressed. I believe these changes come closer to this goal. Enjoy. If not, I am enjoying it Change-Id: I664eace546c364b815b4dc9ed4a72849231a0eb2 Reviewed-on: http://gerrit.rockbox.org/626 Tested: Purling Nayuki <cyq.yzfl@gmail.com> Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2013-12-13Add support for flac embeded album art.Albert Song1-0/+50
Change-Id: I077768f7d80b57976f9a7278b640ef67cf4f2af2 Reviewed-on: http://gerrit.rockbox.org/694 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2013-11-18flac: fix seeking.Andrew Ryabinin1-1/+1
As comment in code states: "It is possible for our seek to land in the middle of audio data that looks exactly like a frame header from a future version of an encoder. When that happens, frame_sync() will return false. But there is a remote possibility that it is properly synced at such a "future-codec frame", so to make sure, we wait to see several "unparseable" errors in a row before bailing out." Currently we wait for 10 "unparseable" errors. libFLAC waits for 20. But I've got a valid flac+cue, wherein switching to certain track gave me 24 "unparsaeable" errors. Therefore I increased unparseable_count to 30. Change-Id: I4e97a5385c729adf3d5075d41ea312622c69e548 Reviewed-on: http://gerrit.rockbox.org/658 Reviewed-by: Michael Giacomelli <giac2000@hotmail.com> Reviewed-by: Boris Gjenero <boris.gjenero@gmail.com> Tested-by: Andrew Ryabinin <ryabinin.a.a@gmail.com> Reviewed-by: Andrew Ryabinin <ryabinin.a.a@gmail.com>
2013-10-20Add missing #include statements.Kevin Zheng3-0/+6
Although Linux accepts several implicit definitions of SEEK_END found in stdio.h, the compiler on FreeBSD won't. Rockbox compilation will fail without stdio.h included. There is a precedent for including this header, see lib/rbcodec/codecs/libtremor/ivorbisfile.h. Change-Id: I58510101b59a354cd6601cb3f323f385a824d2e8 Reviewed-on: http://gerrit.rockbox.org/639 Tested-by: Kevin Zheng <kevinz5000@gmail.com> Reviewed-by: Frank Gevaerts <frank@gevaerts.be>
2013-10-05Simulator - encoders can now be loadedLorenzo Miori1-1/+2
This enables the encoders - i.e. to record audio - to be loaded also on the simulator. Change-Id: I54fdbeb75b89023c0d7824a34cf76301c02c3150 Reviewed-on: http://gerrit.rockbox.org/632 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2013-09-01Opus: delete two files that were moved into a subdirNils Wallménius2-108/+0
Change-Id: I54ef0dfd57fbb493ad38855767a8f5e724e5bc65
2013-09-01Fix warning from a35c1b3Nils Wallménius1-1/+1
Change-Id: I0e9b2c265a6a2355dc39b1696df4c8f266d9a638
2013-09-01Opus: Coldfire inline asm for comb_filter_constNils Wallménius1-0/+33
Speeds up decoding a 64kbps test file by 2.6MHz Change-Id: Ibeb30f37cc00a4a6f65b64851009753f40e06fc1
2013-08-31Add cf asm inline for multiplication commonly used in silk.Nils Wallménius2-0/+54
Speeds up decoding a 16kbps test file by 4.9MHz on h300. Change-Id: I8c25431c98dfa9a1c3806a84055e0847eb77a9f1
2013-08-31Put two hot silk arrays on real stack (iram)Nils Wallménius2-6/+10
Speeds up decoding of 16kbps test file by 16.7MHz on H300. Change-Id: I39c90e3b423ae8e2ee5c2b88c5dcec8d48807f77
2013-08-31Silence spurious warningNils Wallménius1-1/+1
Change-Id: I856c722e959314c0a86e9c0a3a31cb824ddb41cc
2013-08-31Sync opus codec to upstream gitNils Wallménius115-4290/+4825
Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
2013-08-26lua: Switch memory allocator from dl to tlsfMarcin Bukat1-3/+11
Instead of providing yet another memory allocator implementation use tlsf and simply link tlsf library. Another small improvement is to *grow* memory pool by grabbing audiobuffer instead of just switching to use audiobuf exclusively. Tested with simple lua 'memory eater' script. This patch extends tlsf lib slightly. You can provide void *get_new_area(size_t * size) function which will override weak dummy implementation provided in lib itself. This allows to automaticaly initialize memory pool as well as grow memory pool if needed (for example grab audiobuffer when pluginbuffer is exhaused). Change-Id: I841af6b6b5bbbf546c14cbf139a7723fbb982f1b
2013-08-23Change CODECFLAGS to a "simply-expanded" var to give the individualNils Wallménius3-16/+18
codec makefiles larger freedom in what they can do to it. Use this in libopus to prepend the libopus searchpaths to CODECFLAGS so that its internal config.h will be picked up before our global one. This avoids having to do a s/config.h/opus_config.h/ when syncing which will be handy soon. Change-Id: I018d729aa0c8300fa3149f22a5a8c5668b339dfa Reviewed-on: http://gerrit.rockbox.org/496 Reviewed-by: Nils Wallménius <nils@rockbox.org>
2013-08-16Fix FS#12889 : Audible pop right after setting Repeat/ShuffleMichael Sevakis1-0/+3
The quickscreen calls settings_apply() and the crossfeed code wasn't checking that the right crossfeed was set before updating the filter for the custom setting, which was overwriting the Meier crossfeed data (custom and Meier share the same data space). Change-Id: Ifaa2f46fe062d4497681a2dd0d5068ec906c96a3
2013-07-11mp3_enc: Fix early snafu with stream finish on COPMichael Sevakis1-23/+14
Distractions make logic fail. It only needs one more loop and should not trigger further compression cycles after not feeding more data. Change-Id: Ie0dbb34af92e0ca5718480dd4ab4719a141717ff
2013-07-09Multithread compressing encoders on multicore targets.Michael Sevakis2-1806/+2302
For mp3_enc, split encoding duties between COP and CPU. For wavpack_enc, simply run the encoding on COP (splitting that one needs more consideration) which keeps the it and the UI from running on the same core. As a result, at least they are now useable on PP at "normal" sample rates. mp3_enc in all this gets an extensive renovation and some optimizations for speed, to reduce IRAM requirements and remove unneeded stuff. Change-Id: I215578dbe36f14e516b05a5ca70880eb01ca0ec2
2013-07-06Enable setting of global output samplerate on certain targets.Michael Sevakis17-196/+377
Replaces the NATIVE_FREQUENCY constant with a configurable frequency. The user may select 48000Hz if the hardware supports it. The default is still 44100Hz and the minimum is 44100Hz. The setting is located in the playback settings, under "Frequency". "Frequency" was duplicated in english.lang for now to avoid having to fix every .lang file for the moment and throwing everything out of sync because of the new play_frequency feature in features.txt. The next cleanup should combine it with the one included for recording and generalize the ID label. If the hardware doesn't support 48000Hz, no setting will be available. On particular hardware where very high rates are practical and desireable, the upper bound can be extended by patching. The PCM mixer can be configured to play at the full hardware frequency range. The DSP core can configure to the hardware minimum up to the maximum playback setting (some buffers must be reserved according to the maximum rate). If only 44100Hz is supported or possible on a given target for playback, using the DSP and mixer at other samperates is possible if the hardware offers them. Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622 Reviewed-on: http://gerrit.rockbox.org/479 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-06-30Update software recording engine to latest codec interface.Michael Sevakis5-1224/+862
Basically, just give it a good rewrite. Software codec recording can be implemented in a more straightforward and simple manner and made more robust through the better codec control now available. Encoded audio buffer uses a packed format instead of fixed-size chunks and uses smaller data headers leading to more efficient usage. The greatest benefit is with a VBR format like wavpack which needs to request a maximum size but only actually ends up committing part of that request. No guard buffers are used for either PCM or encoded audio. PCM is read into the codec's provided buffer and mono conversion done at that time in the core if required. Any highly-specialized sample conversion is still done within the codec itself, such as 32-bit (wavpack) or interleaved mono (mp3). There is no longer a separate filename array. All metadata goes onto the main encoded audio buffer, eliminating any predermined file limit on the buffer as well as not wasting the space for unused path queue slots. The core and codec interface is less awkward and a bit more sensible. Some less useful interface features were removed. Threads are kept on narrow code paths ie. the audio thread never calls encoding functions and the codec thread never calls file functions as before. Codecs no longer call file functions directly. Writes are buffered in the core and data written to storage in larger chunks to speed up flushing of data. In fact, codecs are no longer aware of the stream being a file at all and have no access to the fd. SPDIF frequency detection no longer requires a restart of recording or plugging the source before entering the screen. It will poll for changes and update when stopped or prerecording (which does discard now-invalid prerecorded data). I've seen to it that writing a proper header on full disk works when the format makes it reasonably practical to do so. Other cases may have incorrect data sizes but sample info will be in tact. File left that way may play anyway. mp3_enc.codec acquires the ability to write 'Info' headers with LAME tags to make it gapless (bonus). Change-Id: I670685166d5eb32ef58ef317f50b8af766ceb653 Reviewed-on: http://gerrit.rockbox.org/493 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-06-30Fix some whitespace in files changed in following commit.Michael Sevakis4-37/+37
Change-Id: Ie3f43e43076e0dcae9a10f1b0b9e4698b398acee Reviewed-on: http://gerrit.rockbox.org/492 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-06-21Remove old EQ presets.Michael Giacomelli28-436/+0
The old presets never made sense for Rockbox's EQ. They were apparently copied from some other software. We have a parametric EQ, that means that EQ bands can be made wider or narrower. Putting two identical bands side by side just wastes battery life and adds rounding error. Replacement presets are on gerrit but they need more work. In the mean time, users should probably not be using these. Change-Id: I85213100129fafd3ac0fa1a9438cb4d651bb94cb
2013-06-16Silence some (harmless) warnings.Frank Gevaerts1-1/+0
Change-Id: I8d1278b8cfaa376d2ad5a99dd552dc980c66e1da
2013-06-15Fix id3v2 album art if more than one image is present.Dominik Riebeling1-1/+8
Rockbox only uses the first album art image (APIC / PIC frame) found in id3v2 tags. When a file contains more than one image the second one is ignored but the parsealbumart() callback overwrites the already set data. This causes the metadata structure to contain an invalid pointer to the image data, resulting in no image shown. Make parsealbumart() aware of this and skip parsing when an albumart image has already been found. Fixes FS#12870. Change-Id: Id8164f319cd5e1ee868b581f8f4ad3ea69c17f77
2013-05-27Missed removing a couple unwanted includes in previous commit.Michael Sevakis3-3/+7
Get those too. Change-Id: Id2a39afe7a61d6ec0cea38633b94fe1b7122204f
2013-05-27Remove explicit config.h and system.h includes from DSP code.Michael Sevakis16-31/+34
Replace with rbcodecconfig.h and platform.h includes. Remove now- unneeded ones as well. Change-Id: I6111b71e90bf86d9fe272a7916f2d34a5c6dd724
2013-05-26SPC Codec ARMv5: I didn't have fast gauss quite right.Michael Sevakis1-5/+5
Fix wrapping hazard which did eventually manifest on the right file. Change-Id: I996a6efd3181b56fd172b5c3a526c7434f88bbbe
2013-05-23Fix return address when data_abort_handler skips faulting instruction.Boris Gjenero1-1/+1
When writing a value to PC, execution continues at that location, so subtracting 4 returns to the next instruction. Previously, two instructions after the faulting instruction were being skipped, causing safe_read functions to return true even if a data abort happened. Change-Id: I3fd02d54646323ea2050d0504e38f6d22f09c749
2013-05-23Remove dsp_callback because DSP is now library code, not app code.Michael Sevakis3-56/+9
Yep, nope, not necessary anymore. Just call functions directly. Change-Id: I21dc35f8d674c2a9c8379b7cebd5613c1f05b5eb
2013-05-23SPC Codec: Add ARMv5 optimized code. Easy peasy.Michael Sevakis4-1/+291
Why? Why not? Cuts a few MHz. Change-Id: Ied5c70b1aedd255cbe5d42b7d3028bbe47aad01d
2013-05-21SPC Codec: Simplify configuration and assume nothing need be disabled.Michael Sevakis1-33/+21
Most SoCs are these days are fast enough for realtime BRR, gaussian interpolation and echo processing. Change-Id: I180ce8ad45242c67b5e573a406b9522098a3f12b
2013-05-21SPC Codec: Have metadata parser fill in frequency and bitrate.Michael Sevakis1-0/+2
Change-Id: I6c72f4d1c79b1a99a11fb28e7d46886c08a56a75
2013-05-21SPC Codec: Need to restore a bit more data from cached waves.Michael Sevakis2-59/+53
'Nuff said. Last update wasn't quite right. Change-Id: I082a79c4e0c82b968fe2375cb82ee5c3a64a208b
2013-05-21Opus: fix glitch caused by 2e9aa3dNils Wallménius1-6/+6
Change-Id: I1519f3bf2cdf74f3d4741951973352b2678b7722
2013-05-21Fix FS#9577 - SNES player missing tracks on certain SPCsMichael Sevakis2-44/+85
Affected BRR cached waveforms but not realtime BRR decode as far as I could ascertain. BRR cached waves required loop points to be inside the initial waveform but this change removes that restriction. Change-Id: I0ef4db720e5c28bd7b2fb9ae255d27c0a7213f79
2013-05-21Fix 87021f7 errors. There is no this->echo_pos when SPC_NOECHO != 0.Michael Sevakis1-1/+1
Anyway, that's true now. Change-Id: I247ea9a10543a8b65f3e73495f0e2ea725ec533e
2013-05-21SPC Codec: Refactor for CPU and clean up some things.Michael Sevakis12-1295/+1690
CPU optimization gets its own files in which to fill-in optimizable routines. Some pointless #if 0's for profiling need removal. Those macros are empty if not profiling. Force some functions that are undesirable to be force-inlined by the compiler to be not inlined. Change-Id: Ia7b7e45380d7efb20c9b1a4d52e05db3ef6bbaab
2013-05-19Opus: fix seeking to start of trackNils Wallménius1-2/+3
Change-Id: I8a8604d6726304d04281671b475b2f75f9bfc0e5
2013-05-19Opus: avoid allocating space for comment packetsNils Wallménius1-0/+6
Fixes playback of files with large embedded album art. Change-Id: I94d336e3da968a93047dd00a5fa65e4c3423a7da
2013-05-18Fix opus craches with large embedded album artNils Wallménius4-44/+42
Use the tlsf malloc and friends instead of the silly codec_malloc to get actually working free and saner realloc that doesn't leak memory. Makes files with moderately sized embedded AA play on targets with large enough codec buffers and files with too large AA are now skipped rather than crashing. Fixes crash when playing example file in FS#12842. Change-Id: I06562955c4d9a95bd90f55738214fba462092b71
2013-05-16Introduce new hermite polynomial resampler.Michael Sevakis3-260/+543
Uses the Catmull-Rom case of Hermite cubic splines. Vastly improves the quality and accuracy of audio resampling with a rather minor additional overhead compared to the previous linear implementation. ARM and Coldfire assembly implementations included. Change-Id: Ic45d84bc66c5b312ef373198297a952167a4be26 Reviewed-on: http://gerrit.rockbox.org/304 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-05-07Rename all the "lin_resample..." stuff to simply "resample_...".Michael Sevakis4-45/+42
Change-Id: I79f44f0dcc1b23b33a5040795220713660a1d18a
2013-05-05Purge the usage of DSP_SWITCH_FREQUENCY.Michael Sevakis26-27/+26
DSP_SWITCH_FREQUENCY has been deprecated and the same enumerated value as DSP_SET_FREQUENCY since major DSP revisions were committed. This task should have been performed much earlier but, oh well, do it now. Change-Id: I3f30d651b894136a07c7e17f78fc16a7d98631ff
2013-05-04Revert "Don't set CORE_GCSECTIONS in fixedpoint.make."Dominik Riebeling1-0/+1
While it made the mini2g not crash during startup anymore further tests showed that other mini2g devices still exhibit the crash, or end up with a "No partition found" error; furthermore the device tested first still crashes on USB disconnect. Therefore the change doesn't really help with the problem, and at the expense of increasing binary size for all other targets there is no point in keeping it for now. This reverts commit 850491a043a9341ef31ffb8c02eedd2ae7b2c53e.
2013-05-04Fix missed optimization opportunity in dsp_process.Michael Sevakis1-3/+3
Input type can only change once per call because the DSP parameters are only copied at the start and input is always taken from the src buffer which means sample input format switching can be once per call instead of once per loop. Change-Id: Ifa3521753428fb0e6997e4934f24a3b915628cc7
2013-05-04Cleanup and simplify latest DSP code incarnation.Michael Sevakis15-540/+513
Some things can just be a bit simpler in handling the list of stages and some things, especially format change handling, can be simplified for each stage implementation. Format changes are sent through the configure() callback. Hide some internal details and variables from processing stages and let the core deal with it. Do some miscellaneous cleanup and keep things a bit better factored. Change-Id: I19dd8ce1d0b792ba914d426013088a49a52ecb7e
2013-04-28Don't set CORE_GCSECTIONS in fixedpoint.make.Dominik Riebeling1-1/+0
fixedpoint.make is not a subdir Makefile but a lib Makefile. Setting CORE_GCSECTIONS in it will affect the final link and make it always use --gc-sections (for SWCODEC Rockbox), since libfixedpoint is always needed (bootloader and HWCODEC don't use libfixedpoint). Fixes FS#12857. Change-Id: Ib30bd03cbcea9c339a73daf7b673868aa3cc7a88
2013-04-26Properly seek to next id3v2 frame for unsynced tags.Dominik Riebeling1-3/+10
When seeking to the next id3v2 frame we need to consider if the tag has the unsync flag set. Not doing so will likely make parsing end up in the middle of the current frame if the frame size exceeds the upper limit set during read. The latter usually happens for album art frames. Fixes FS#12849. Change-Id: Ic92853eef4374508d84df347bcc66b6661d5037d
2013-04-25Properly implement volume in warble. dB cut only.Michael Sevakis2-9/+36
Change-Id: I34b77287ba0b1a0002db3d52e893a52c50593362
2013-04-25Add $(SHARED_CFLAGS) to fixedpoint.make to quash amd64 errors in 95e23de.Michael Sevakis1-1/+1
Thanks to Frank Gevaerts. Change-Id: I6ca1d0258bfc70950d0ad5c2975d2bd88060b8a3
2013-04-26Make fixepoint.c as a shared library (libfixedpoint.a).Michael Sevakis10-32/+623
Change-Id: Icc10d6e85f890c432f191233a4d64e09f00be43d Reviewed-on: http://gerrit.rockbox.org/456 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>