Commit graph

282 commits

Author SHA1 Message Date
Michael Sevakis
bfbec3a3a7 Remove unused return value variable in lib/unwarminder/backtrace.c
Stop the Android warning about it

Change-Id: I2f01220004f128befaa5757786b8de174566cbb5
2014-08-25 14:07:19 -04:00
Michael Sevakis
528715a672 Fix warnings from 6ed0087
Forgot to (void) an unused parameter when priorityless.

usb-drv-rl27xx.c was using a compound init to initialize a semaphore
but the structure changed so that it is no longer correct. Use
designated initializers to avoid having to complete all fields.

Forgot to break compatibility on all plugins and codecs since the
kernel objects are now different. Take care of that too and do the
sort thing.

Change-Id: Ie2ab8da152d40be0c69dc573ced8d697d94b0674
2014-08-16 06:00:36 -04:00
Chiwen Chang
9fb65294fb add supports for x,y value in percentage to several tags.
including
BAR_PARAMS, %xl, %dr, %T,%St, %xl and %Cl

Change-Id: I0811ebfff5f83085481dcbf08f97b7223f677bfe
Reviewed-on: http://gerrit.rockbox.org/900
Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2014-07-21 04:54:53 +02:00
Nils Wallménius
8e8671a73e libopus: use iram for more constants
Speeds up decoding of the 64 kbps test file by 2.59 MHz and the
128 kbps test file by 4.31 MHz on H300 (cf). Decoding the same
files on c200 is sped up by 0.33 MHz and 0.55 MHz respectively.

Change-Id: I0f9f9ef6a7293581cf45e3201b33c65504c95c81
2014-07-13 14:19:54 +02:00
Nils Wallménius
888e05ec12 libopus: asm C_MUL for coldfire
The recent merge of upstream changed the fft to use C_MUL which
wasn't implemented in asm for coldfire.

Speeds up decoding 64 kbps test file by 2.68 MHz and 128 kbps
test file by 2.80 MHz on H300.

Change-Id: I8b61fc0f9568d6350431e311a12e44fe4f60f72e
2014-07-13 11:49:34 +02:00
Nils Wallménius
9b7ec42403 Sync to upstream libopus
Sync to commit bb4b6885a139644cf3ac14e7deda9f633ec2d93c

This brings in a bunch of optimizations to decode speed
and memory usage. Allocations are switched from using
the pseudostack to using the real stack. Enabled hacks
to reduce stack usage.

This should fix crashes on sansa clip, although some
files will not play due to failing allocations in the
codec buffer.

Speeds up decoding of the following test files:

                 H300 (cf)   C200 (arm7tdmi)  ipod classic (arm9e)
16 kbps (silk)   14.28 MHz   4.00 MHz         2.61 MHz
64 kbps (celt)   4.09 MHz    8.08 MHz         6.24 MHz
128 kbps (celt)  1.93 MHz    8.83 MHz         6.53 MHz

Change-Id: I851733a8a5824b61feb363a173091bc7e6629b58
2014-07-13 11:12:40 +02:00
Thomas Martitz
466441dc14 libmad: Use 32bit unsigned for requantize table.
Implicit promotion of integer literals to unsigned long introduced a subtle bug
on 64-bit systems due to weird sign extensions (leads to audible glitches in a
few files). The table is originally designed for unsigned 32bit integers, and
it works with those so use them. As a consequence the lookup table size is
halved as well.

Change-Id: I35d878d6df03300387f0e403e0f3c3bdc73eea00
2014-04-15 23:49:07 +02:00
Michael Sevakis
31b7122867 Implement time-based resume and playback start.
This complements offset-based resume and playback start funcionality.
The implementation is global on both HWCODEC and SWCODEC.

Basically, if either the specified elapsed or offset are non-zero,
it indicates a mid-track resume.

To resume by time only, set elapsed to nonzero and offset to zero.
To resume by offset only, set offset to nonzero and elapsed to zero.

Which one the codec uses and which has priority is up to the codec;
however, using an elapsed time covers more cases:

* Codecs not able to use an offset such as VGM or other atomic
formats

* Starting playback at a nonzero elapsed time from a source that
contains no offset, such as a cuesheet

The change re-versions pretty much everything from tagcache to nvram.

Change-Id: Ic7aebb24e99a03ae99585c5e236eba960d163f38
Reviewed-on: http://gerrit.rockbox.org/516
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2014-03-10 04:12:30 +01:00
Thomas Martitz
68768260e8 Fix more reds.
Change-Id: I4b58dda0953b7f9799238c32b78037b0a5403c04
2014-03-03 20:26:08 +01:00
Thomas Martitz
c245de029d Fix various reds. Some includes needed fixup.
Change-Id: I4327740bae17054131feb917abdd58846c451988
2014-03-03 19:10:48 +01:00
Jack Whitham
ca423ed0e3 Proposed fix for FS#12878: Zero-length embedded album art prevents mp3 playback
see http://www.rockbox.org/tracker/task/12878

Change-Id: Ib4233c06e18d1d193dfb9e73e745ca5d174e40b2
Reviewed-on: http://gerrit.rockbox.org/507
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2013-12-23 17:55:15 +01:00
Nils Wallménius
e3c2ed7a71 Sync libopus to upstream release 1.1
Change-Id: I9fea7460fc33f60faff961b3389dd97b5191463c
2013-12-16 21:13:23 +01:00
Ryan Billing
d0918b98fa DSP Compressor: Sidechain, Exponential Atk/Rls
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-15 22:24:08 +01:00
Albert Song
f633d5ed48 Add support for flac embeded album art.
Change-Id: I077768f7d80b57976f9a7278b640ef67cf4f2af2
Reviewed-on: http://gerrit.rockbox.org/694
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2013-12-13 12:37:20 +01:00
Andrew Ryabinin
b770f63934 flac: fix seeking.
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-11-18 07:45:59 +01:00
Kevin Zheng
4626b1770b Add missing #include statements.
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-20 16:52:46 +02:00
Lorenzo Miori
0f1d44dba2 Simulator - encoders can now be loaded
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-10-05 12:25:13 +02:00
Nils Wallménius
b97cdc8f5e Opus: delete two files that were moved into a subdir
Change-Id: I54ef0dfd57fbb493ad38855767a8f5e724e5bc65
2013-09-01 18:36:12 +02:00
Nils Wallménius
3000ca32f9 Fix warning from a35c1b3
Change-Id: I0e9b2c265a6a2355dc39b1696df4c8f266d9a638
2013-09-01 17:54:10 +02:00
Nils Wallménius
a35c1b3595 Opus: Coldfire inline asm for comb_filter_const
Speeds up decoding a 64kbps test file by 2.6MHz

Change-Id: Ibeb30f37cc00a4a6f65b64851009753f40e06fc1
2013-09-01 17:39:15 +02:00
Nils Wallménius
516f7fbd6c Add cf asm inline for multiplication commonly used in silk.
Speeds up decoding a 16kbps test file by 4.9MHz on h300.

Change-Id: I8c25431c98dfa9a1c3806a84055e0847eb77a9f1
2013-08-31 17:57:33 +02:00
Nils Wallménius
b592a7a8a5 Put two hot silk arrays on real stack (iram)
Speeds up decoding of 16kbps test file by 16.7MHz on H300.

Change-Id: I39c90e3b423ae8e2ee5c2b88c5dcec8d48807f77
2013-08-31 17:14:58 +02:00
Nils Wallménius
a602ea3d3d Silence spurious warning
Change-Id: I856c722e959314c0a86e9c0a3a31cb824ddb41cc
2013-08-31 09:00:13 +02:00
Nils Wallménius
580b307fd7 Sync opus codec to upstream git
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-31 08:30:51 +02:00
Marcin Bukat
a2a2e14e0d lua: Switch memory allocator from dl to tlsf
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-26 09:42:47 +02:00
Nils Wallménius
b2e80edd16 Change CODECFLAGS to a "simply-expanded" var to give the individual
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-23 18:34:30 +02:00
Michael Sevakis
b1209d4789 Fix FS#12889 : Audible pop right after setting Repeat/Shuffle
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-08-16 09:28:36 -04:00
Michael Sevakis
e04e29d017 mp3_enc: Fix early snafu with stream finish on COP
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-11 04:50:27 -04:00
Michael Sevakis
95bc93194e Multithread compressing encoders on multicore targets.
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-09 06:28:33 -04:00
Michael Sevakis
d37bf24d90 Enable setting of global output samplerate on certain targets.
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-07-06 04:22:04 +02:00
Michael Sevakis
4888131972 Update software recording engine to latest codec interface.
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-30 00:40:27 +02:00
Michael Sevakis
a9ea1a4269 Fix some whitespace in files changed in following commit.
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-30 00:40:09 +02:00
Michael Giacomelli
d475dd36a3 Remove old EQ presets.
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-21 16:53:02 +02:00
Frank Gevaerts
d4061a46d8 Silence some (harmless) warnings.
Change-Id: I8d1278b8cfaa376d2ad5a99dd552dc980c66e1da
2013-06-16 18:23:18 +02:00
Dominik Riebeling
b6ddbc41a5 Fix id3v2 album art if more than one image is present.
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-06-15 21:04:13 +02:00
Michael Sevakis
46688a60db Missed removing a couple unwanted includes in previous commit.
Get those too.

Change-Id: Id2a39afe7a61d6ec0cea38633b94fe1b7122204f
2013-05-27 03:40:02 -04:00
Michael Sevakis
b5a6517e9d Remove explicit config.h and system.h includes from DSP code.
Replace with rbcodecconfig.h and platform.h includes. Remove now-
unneeded ones as well.

Change-Id: I6111b71e90bf86d9fe272a7916f2d34a5c6dd724
2013-05-27 03:23:33 -04:00
Michael Sevakis
30fe6eb66c SPC Codec ARMv5: I didn't have fast gauss quite right.
Fix wrapping hazard which did eventually manifest on the right file.

Change-Id: I996a6efd3181b56fd172b5c3a526c7434f88bbbe
2013-05-26 00:33:30 -04:00
Boris Gjenero
4077eac839 Fix return address when data_abort_handler skips faulting instruction.
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-23 19:51:19 -04:00
Michael Sevakis
6e211ab3ac Remove dsp_callback because DSP is now library code, not app code.
Yep, nope, not necessary anymore. Just call functions directly.

Change-Id: I21dc35f8d674c2a9c8379b7cebd5613c1f05b5eb
2013-05-23 14:25:37 -04:00
Michael Sevakis
33f3af2b8d SPC Codec: Add ARMv5 optimized code. Easy peasy.
Why? Why not? Cuts a few MHz.

Change-Id: Ied5c70b1aedd255cbe5d42b7d3028bbe47aad01d
2013-05-23 03:15:12 -04:00
Michael Sevakis
9b43f14165 SPC Codec: Simplify configuration and assume nothing need be disabled.
Most SoCs are these days are fast enough for realtime BRR, gaussian
interpolation and echo processing.

Change-Id: I180ce8ad45242c67b5e573a406b9522098a3f12b
2013-05-21 20:39:22 -04:00
Michael Sevakis
ed24e62029 SPC Codec: Have metadata parser fill in frequency and bitrate.
Change-Id: I6c72f4d1c79b1a99a11fb28e7d46886c08a56a75
2013-05-21 20:01:17 -04:00
Michael Sevakis
1f76edabf9 SPC Codec: Need to restore a bit more data from cached waves.
'Nuff said. Last update wasn't quite right.

Change-Id: I082a79c4e0c82b968fe2375cb82ee5c3a64a208b
2013-05-21 16:59:58 -04:00
Nils Wallménius
de86b4a3c5 Opus: fix glitch caused by 2e9aa3d
Change-Id: I1519f3bf2cdf74f3d4741951973352b2678b7722
2013-05-21 22:38:18 +02:00
Michael Sevakis
71b9685dcd Fix FS#9577 - SNES player missing tracks on certain SPCs
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-21 04:29:04 -04:00
Michael Sevakis
00e55d0451 Fix 87021f7 errors. There is no this->echo_pos when SPC_NOECHO != 0.
Anyway, that's true now.

Change-Id: I247ea9a10543a8b65f3e73495f0e2ea725ec533e
2013-05-21 00:20:06 -04:00
Michael Sevakis
87021f7c0a SPC Codec: Refactor for CPU and clean up some things.
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-21 00:02:14 -04:00
Nils Wallménius
a17d6de5bc Opus: fix seeking to start of track
Change-Id: I8a8604d6726304d04281671b475b2f75f9bfc0e5
2013-05-19 14:20:31 +02:00
Nils Wallménius
2e9aa3d8b0 Opus: avoid allocating space for comment packets
Fixes playback of files with large embedded album art.

Change-Id: I94d336e3da968a93047dd00a5fa65e4c3423a7da
2013-05-19 14:19:09 +02:00