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>
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>
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>
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>
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
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
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>
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
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
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
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>
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>
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
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
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
Most SoCs are these days are fast enough for realtime BRR, gaussian
interpolation and echo processing.
Change-Id: I180ce8ad45242c67b5e573a406b9522098a3f12b
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
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
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
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>
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
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 850491a043.
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
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
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
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