summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec/dsp
AgeCommit message (Collapse)AuthorFilesLines
2020-09-08surround: Fix two issues with the haas surround code.Solomon Peachy1-2/+3
1) Handle ID 0 is legal 2) Make sure handle is initialized before trying to memset its buffer Change-Id: I91db157863800c01dd9b92bc05a1df5c4fe0e95b
2017-10-12PBE+Surround: Localize some variables and fixup some flush opsMichael Sevakis2-73/+55
Change-Id: I9fba5b8cbf69d261a7ca1c66e080c08d2fc6d9db
2017-10-12Nitpick configuration code in a few DSP filters to fix some bugsMichael Sevakis3-84/+125
Most importantly is surround shouldn't operate in mono mode. Have it watch and (de)activate itself on relevant format changes as it should. Other changes to better handle buffer allocation failure. PBE was set internally at 100 by default; SBZ. Change-Id: I328e0b674e56751a255eae817d7892d685796b06
2017-07-30rbcodec: fix compilation in debug modeAmaury Pouly3-3/+3
Change-Id: I124cf59c641c2e161cc147b031d9bef5ef773dfb
2015-02-02iBasso DX50/DX90: Major code cleanup and reorganization.Udo Schläpfer1-5/+5
Reorganization - Separated iBasso devices from PLATFORM_ANDROID. These are now standlone hosted targets. Most device specific code is in the firmware/target/hosted/ibasso directory. - No dependency on Android SDK, only the Android NDK is needed. 32 bit Android NDK and Android API Level 16. - Separate implementation for each device where feasible. Code cleanup - Rewrite of existing code, from simple reformat to complete reimplementation. - New backlight interface, seperating backlight from touchscreen. - Rewrite of device button handler, removing unneeded code and fixing memory leaks. - New Debug messages interface logging to Android adb logcat (DEBUGF, panicf, logf). - Rewrite of lcd device handler, removing unneeded code and fixing memory leaks. - Rewrite of audiohw device handler/pcm interface, removing unneeded code and fixing memory leaks, enabling 44.1/48kHz pthreaded playback. - Rewrite of power and powermng, proper shutdown, using batterylog results (see http://gerrit.rockbox.org/r/#/c/1047/). - Rewrite of configure (Android NDK) and device specific config. - Rewrite of the Android NDK specific Makefile. Misc - All plugins/games/demos activated. - Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa. Includes - http://gerrit.rockbox.org/r/#/c/993/ - http://gerrit.rockbox.org/r/#/c/1010/ - http://gerrit.rockbox.org/r/#/c/1035/ Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight interface and new option for hold switch, touchscreen, physical button interaction. Rockbox needs the iBasso DX50/DX90 loader for startup, see http://gerrit.rockbox.org/r/#/c/1099/ The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If /mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit gracefully and the loader will restart Rockbox on USB disconnect. Tested on iBasso DX50. Compiled (not tested) for iBasso DX90. Compiled (not tested) for PLATFORM_ANDROID. Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-01-30fix surround & pbe dsp crashChiwen Chang2-2/+4
check handle before clean up buffer in flush(). Change-Id: I36a130c45c9f5dce97aa723ef98922b6935ead75
2015-01-22fix pbe/haas surround dsps: surround_enabled, redo flush functions.Chiwen Chang2-26/+11
surround_enabled was never true, end up dsp_surround_flush didn't work; Thats why a cracking noise occurs in right channel when moving track positions. redo pbe/surround flush in a much simpler way suits the current single buffer style. Change-Id: I394054ddfb164b82c90b3dcf49df4442db87d8d2
2015-01-19three new DSPsChiwen Chang10-5/+849
perceptual bass enhancement - a bbe-ish group delay corrction with Biophonic EQ boost. - precut auditory fatigue reduction -reduce signal in frequency that may trigger temporary threshold shift haas surround -frequency between f(x1) and f(x2) is always bypassed. -can apply to side only. Change-Id: Icb6355ce9b1c99bf2c58c9385c3c411c0ae209d3
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-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-06Enable setting of global output samplerate on certain targets.Michael Sevakis15-194/+370
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-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-05-27Missed removing a couple unwanted includes in previous commit.Michael Sevakis2-3/+0
Get those too. Change-Id: Id2a39afe7a61d6ec0cea38633b94fe1b7122204f
2013-05-27Remove explicit config.h and system.h includes from DSP code.Michael Sevakis15-31/+22
Replace with rbcodecconfig.h and platform.h includes. Remove now- unneeded ones as well. Change-Id: I6111b71e90bf86d9fe272a7916f2d34a5c6dd724
2013-05-23Remove dsp_callback because DSP is now library code, not app code.Michael Sevakis2-55/+8
Yep, nope, not necessary anymore. Just call functions directly. Change-Id: I21dc35f8d674c2a9c8379b7cebd5613c1f05b5eb
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 Sevakis3-44/+41
Change-Id: I79f44f0dcc1b23b33a5040795220713660a1d18a
2013-05-05Purge the usage of DSP_SWITCH_FREQUENCY.Michael Sevakis1-1/+0
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-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-15Straighten out the mad twisted state of sound.c and related areas.Michael Sevakis2-43/+56
This is going right in since it's long overdue. If anything is goofed, drop me a line or just tweak it yourself if you know what's wrong. :-) Make HW/SW codec interface more uniform when emulating HW functionality on SWCODEC for functions such as "audiohw_set_pitch". The firmware-to- DSP plumbing is in firmware/drivers/audiohw-swcodec.c. "sound_XXX" APIs are all in sound.c with none in DSP code any longer. Reduce number of settings definitions needed by each codec by providing defaults for common ones like balance, channels and SW tone controls. Remove need for separate SIM code and tables and add virtual codec header for hosted targets. Change-Id: I3f23702bca054fc9bda40f49824ce681bb7f777b
2013-04-11Implement universal in-PCM-driver software volume control.Michael Sevakis2-21/+0
Implements double-buffered volume, balance and prescaling control in the main PCM driver when HAVE_SW_VOLUME_CONTROL is defined ensuring that all PCM is volume controlled and level changes are low in latency. Supports -73 to +6 dB using a 15-bit factor so that no large-integer math is needed. Low-level hardware drivers do not have to implement it themselves but parameters can be changed (currently defined in pcm-internal.h) to work best with a particular SoC or to provide different volume ranges. Volume and prescale calls should be made in the codec driver. It should appear as a normal hardware interface. PCM volume calls expect .1 dB units. Change-Id: Idf6316a64ef4fb8abcede10707e1e6c6d01d57db Reviewed-on: http://gerrit.rockbox.org/423 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-02-09EQ settings: Rework the settings to clean up the config file.Jonathan Gordon24-694/+231
Instead of 3 cfg lines per eq band there is now a single line for each: <config name>: <cutoff/center freq>, <q>, <gain> In addition, the config value names make a bit more sense. The old settings are still readable but config.cfg and any new settings files will be written with the new config values. (The old settings will be removed completly sometime after the next stable release). Also a slight rework of the advanced EQ menu UI Change-Id: I9008658d36ded442a5f2f825916df42a3934cbef Reviewed-on: http://gerrit.rockbox.org/394 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2013-01-2910 Band EQ w/PresetsHayden Pearce30-134/+809
- A 10 Band EQ for Rockbox w/ presets adapted from VLC - frequency stepping at 32, 64, 125, 250, 500 1K, 2K, 4K, 8K, 16K Change-Id: I85ad84d70a534edfc66c6ad9af8a76f022a02ec7 Reviewed-on: http://gerrit.rockbox.org/386 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2012-12-28Fix FS#12794 - new EQ code does not compile for the Nokia N8x0Michael Sevakis1-11/+11
The old GCC version currently required (sbox-arm-linux-gcc 3.4.4 release) apparently has trouble with function pointers used as static array initializers when using indexed initializers + ranges (ie. [A ... B] = fn). Change-Id: I494c2b607e4d93a9893264749d0ac257fb54ce3b
2012-05-28New crossfeed algorithm for Rockbox: "Meier" crossfeedBertrik Sikken4-19/+214
Emulates the basic "Meier" crossfeed (2 capacitors, 3 resistors) as discussed in http://www.meier-audio.homepage.t-online.de/passivefilter.htm This crossfeed blends a bit of low-pass filtered L signal into the R signal (and vice versa) while adding about 300 us delay to the crossfed-signal. A difference with the crossfeed already present in rockbox, is that this algorithm keeps the total spectrum flat (the one currently in rockbox accentuates low-frequency signals, making it sound a bit muffled). This implementation is quite lightweight, just 3 multiplies per left-right pair of samples. Has a default C implementation and optimized assembly versions for ARM and Coldfire. The crossfeed effect is quite subtle and is noticeable mostly one albums that have very strong left-right separation (e.g. one instrument only on the left, another only on the right). In the user interface, the new crossfeed option appears as "Meier" and is not configureable. The existing crossfeed is renamed to "Custom" as it allows itself to be customised. There is no entry for the user manual yet. Change-Id: Iaa100616fe0fcd7e16f08cdb9a7f41501973eee1
2012-05-21Stop timestretch freezing things during format changes.Michael Sevakis1-1/+2
When it was inactive but enabled, the format change hook was dropping through to code that it shouldn't execute without it also being active in processing samples. Change-Id: Ie7899df0395d3f0d10f2bf2b55ea549dd06749a7
2012-05-20Revert "Work in progress hermite resampler."Michael Giacomelli1-124/+6
This reverts commit f358228ea1bc66804e9ea12b65c2593c6c1fe8ee.
2012-05-20Work in progress hermite resampler.Michael Giacomelli1-6/+124
Based on http://src.gnu-darwin.org/ports/multimedia/helixplayer/work/hxplay-1.0.7/audio/resampler/hermite.c Change-Id: Id87565a060aa2383701e7c2f3ea023c7555ad9ef
2012-05-13dsp_arm: Fix up some .section directives to fix crash on app targets.Thomas Martitz1-10/+10
This is needed on app targets as e.g. ".section .icode" leads to the code getting linked to incorrect locations (0x0 in this case). Change-Id: Ic28c5ae6d4f8001d211d685b5ca92d5ffff0c7b2
2012-05-12TDSpeed: Fix crackling on some systemsNils Wallménius1-2/+2
Use memmove instead of memcpy for overlapping copy, fixes crackling in sims and warble on my system. Native targets seem to have been unaffected. Change-Id: I265d4ce373e224581bd2f5ba15c75b473ec231f2
2012-05-11TDSpeed settings to setup call need to be recorded, always.Michael Sevakis1-4/+4
If the settings, like samplerate, were to go out of range where timestretch drops out of processing and then go back to the same as when they were valid, it would fail to switch back on by itelf. Change-Id: Ic5bcb268540b0db8e0483117b8a5a0ce5c5a9db0
2012-05-11TDSpeed: Minor assembly optimization to frame fade on Coldfire.Michael Sevakis1-3/+38
Makes quite a huge difference to get rid of 64-bit math in a hot area. Cuts about 12 MHz. Generic routine generates good code on ARM and asm cuts no instructions there. Change-Id: I4ac647406006c42004f9f5ab396cbf4e85688854
2012-05-10TDSpeed: Fix up samples consumed return (FS#12666) + other stuff like...Michael Sevakis1-112/+82
Wrap up the the stereo case into loops and remove unused calculations hanging out in tdspeed_update(). A wee little bit of code style and column policing. Change-Id: I8dd3ab4b3e7e56b55dc00c00f3e32996228cc457
2012-05-09Rename HAVE_PITCHSCREEN to HAVE_PITCHCONTROLNils Wallménius4-8/+8
Also move the definition to config.h Change-Id: I36bb5020c5e06b2344292bc05e8c13ccc7a6a1ff Reviewed-on: http://gerrit.rockbox.org/234 Reviewed-by: Nils Wallménius <nils@rockbox.org>
2012-05-08Tweak dsp_format_change_process (default format handler).Michael Sevakis1-5/+7
Just stop searching if the entry is found (as it should have been). Change-Id: Id968694e825282d58c8ca4a7789c236f98643a5f
2012-05-08Consolidate some sample input code.Michael Sevakis1-59/+38
Input functions have common setup sequences that can be placed into an inline function instead of repeating it all repeatedly. Change-Id: I9e62904ff0948651c64ddf160ed4400ed6dc81ff
2012-05-07rbcodec: abstract tdspeed buffer allocationNils Wallménius2-106/+43
Move code dealing with rockbox specific buflib allocations into a rockbox specific file and implement buffer allocation with malloc/free for warble/stand alone lib. Based on patch by Sean Bartell. Change-Id: I8cb85dad5890fbd34c1bb26abbb89c0b0f6b55cf Reviewed-on: http://gerrit.rockbox.org/144 Tested-by: Nils Wallménius <nils@rockbox.org> Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Reviewed-by: Nils Wallménius <nils@rockbox.org>
2012-05-06Correct comments in lin_resample re: what is actually used by asm.Michael Sevakis1-2/+2
Change-Id: Idd457f3c645c5d469ebc6fab0bfc85e7b8dd56da
2012-05-04Remove pointless IRAM allocation from voice DSP.Michael Sevakis3-12/+66
It's always used in MONO mode and doesn't need the IRAM sample/ resample buffers and 1280 bytes can be freed. M5 can now have its PCM mixer downmix buffer in IRAM. Change-Id: I0af08be5b212b7dfe382bba588a6585eb328a038
2012-05-03rbcodec: Hooks for target specific functions in dsp_process loopMichael Sevakis1-41/+17
Use them to move tick counting, yielding and coldfire macsr handling code to a rockbox specific file. Change-Id: Id7417dc98c08a342eba45ba56b044a276e50564b Reviewed-on: http://gerrit.rockbox.org/229 Tested-by: Nils Wallménius <nils@rockbox.org> Reviewed-by: Nils Wallménius <nils@rockbox.org>
2012-05-01Make INITDATA_ATTR work on everything that has INIT_ATTR enabled for code.Michael Sevakis1-1/+1
Change-Id: If9936bfbbd3bc3eb2a3e3e290701b8517eabfb13
2012-04-30Should've had dsp_replaygain_set_gains as static for now...Michael Sevakis2-7/+6
...because currently gains are only set through dsp_configure. Change-Id: I2866473a82fdd5f41de4705b45928daa7e43f8eb
2012-04-30Still need settings.h in dsp_misc.c for now for software volume.Michael Sevakis1-0/+5
Change-Id: I824e8f9935013f6e2a1db6ccd2db4bd406257057
2012-04-30Make DSP's replaygain independent of global_settings.Michael Sevakis2-45/+52
Moves replaygain definitions to lib/rbcodec/dsp/dsp_misc.h. Intermediate functions in misc.c handle any adjustment and calling the rbcodec APIs. Change-Id: I9f03561bca9aedd13760cf19c4e19aa3c68e7024 Reviewed-on: http://gerrit.rockbox.org/140 Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
2012-04-29Put the <string.h> channel_mode.c for memcpy.Michael Sevakis1-0/+1
Hmmm, how'd I miss that? Change-Id: I30d9a1b5f053aad069687aa0a01ebdf40a6b2d76
2012-04-29Make rbcodec/dsp includes more specific.Michael Sevakis15-38/+33
Change-Id: Idb6af40df26f5b8499a40e8b98602261ef227044
2012-04-29Make compressor_update static.Michael Sevakis1-1/+1
Change-Id: Ic29242b4c397e82c2bee3808492a2d0a9ffebbe6
2012-04-29Lower IRAM footprint on ARM.Michael Sevakis1-4/+4
Move a few functions to .text that probably don't see a huge benefit from being .icode. Will scrutinize later. Change-Id: I7bdffc326076c5cd7e6a1c57d25d31e653920327
2012-04-29Fix 3g warning in dsp_arm.S (which showed as an error).Michael Sevakis1-1/+1
Change-Id: Iccbeca66e809413dda90fec36439b4a180b8a879