Commit graph

311 commits

Author SHA1 Message Date
Amaury Pouly
16d1788356 Fix codecs in simulator builds on Windows
The mingw linker uses strlen() in some cases, and codeclib.c redefines it, that
leads to mingw runtime init to call into our strlen() and then ci->strlen() which
of course crashes. Apply the same fix as for malloc and friends: rename the symbol.

The codeclib.h include is necessary for normal builds.

Change-Id: Ifa85901a3e4a31cc0e10b4b905df348a239d5c99
2017-01-15 21:46:19 +01:00
Amaury Pouly
7e0820fe21 unwinder: in get__sp(), use the more correct "msr cpsr_c, ..." form
Change-Id: I9cfdca80536fc9fb6e8983a81219ccdf5c0b3c42
2016-12-12 13:15:47 +01:00
Amaury Pouly
bbf4ff2c91 Fix DEBUG build codecs
In DEBUG build, the codec API struct is consider with DEBUG flag in apps/
but without DEBUG flah in rbcodecs/, leading to unmatched structure and horrible
crashes in some cases (mostly encoders). I have no idea why the codecs Makefile
removes the DEBUG flag (maybe for performance reasons?) but it cannot be right.

Change-Id: Idb2c5f66741408ec2939624590fc39c4cf69fc2b
2016-12-03 23:07:32 +01:00
Adam Sampson
1f8ea9fe27 Opus: update resume offset correctly while playing.
The codec wasn't calling ci->set_offset() while decoding; as a result,
the saved offset in ci.id3->offset was only updated at the start of the
file and when seeking.

To reproduce the problem in the simulator or on a real device:
- Start playing an Opus file.
- Let it play until 15s, then turn the player off.
- Turn back on and resume playback. This'll resume correctly from 15s
  (using time-based resume, I think, as the offset was 0?).
- Let it play until 30s, then turn the player off again.
- Turn back on and resume playback. This'll resume from 15s, based on
  the initial position from last time, when it should resume from 30s.

I believe this will also fix FS#12799 ("Resuming opus file from bookmark
is not working correctly").

Change-Id: Iba67368e0029c968ef802693767e0722719bc38b
2016-09-07 19:44:37 +02:00
Frank Gevaerts
c926a5269e Fix race conditions in parallel build.
ffmpeg_bitstream.c is included in libcodec, so there doesn't seem to
be any reason for individual codecs to also compile it (and clobber
any previous copy while they're at it, leading to broken builds)

Change-Id: I2bedc277ab109f44a6e8feb3d12ed01a720e00a6
2016-05-28 17:41:32 +02:00
Frank Gevaerts
123346b86a _BSD_SOURCE is deprecated, and we're supposed to use _DEFAULT_SOURCE now.
Change-Id: Ia051bc758c8fe4002e222511fdc6be613cdd39e7
2016-03-18 21:27:15 +01:00
Cástor Muñoz
d68ecccd88 mp3_enc.c: fix MP3 recording at 32 kHz sample rate
Fixes a buffer overflow present when MP3 is encoded at 32000 Hz sample
rate, affected bitrates are 320 and 256 kbps.

Change-Id: I7634e70409be9d675d47be316a42630dd3147636
2015-07-17 01:03:38 +02:00
Udo Schläpfer
dbabd0d9c3 iBasso DX50/DX90: Major code cleanup and reorganization.
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-02-02 21:57:55 +01:00
Chiwen Chang
572b36a51a fix surround & pbe dsp crash
check handle before clean up buffer in flush().

Change-Id: I36a130c45c9f5dce97aa723ef98922b6935ead75
2015-01-30 20:06:00 +01:00
Chiwen Chang
30784cc262 fix pbe/haas surround dsps: surround_enabled, redo flush functions.
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-22 13:28:34 +11:00
Frank Gevaerts
163ca14e58 Enable buflib and core_alloc for warble.
Most of the work comes from http://gerrit.rockbox.org/r/#/c/1088/
by Thomas Jarosch.

Change-Id: Iaa673dad2388d1e44fc95ffaa14bafadc6158101
2015-01-19 21:30:03 +01:00
Chiwen Chang
3ae0f32ac3 three new DSPs
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
2015-01-19 19:34:01 +01:00
Thomas Jarosch
789df17dd9 ARM unwinder for thumb: Fix broken MOV opcode
The origin of the register value was never
moved in the desired register state due to a typo ('rhs' vs. 'rhd').

While looking at the code, I noticed the action taken
for the register value is another copy'n'paste error
from the ADD opcode above -> it added to the register value
instead of MOVing the current value.

Patch submitted upstream.

cppcheck reported:
[lib/unwarminder/unwarm_thumb.c:473]: (warning) Redundant assignment of 'state.regData[rhd].o' to itself.

Change-Id: I78cdbf37a191007a3bddbaa350b906dbce2fe671
2015-01-12 19:36:58 +01:00
Thomas Jarosch
799024198f Fix red
Change-Id: Ia7565dac0f6b9703a5dfff723167620deb218bc3
2015-01-12 19:31:39 +01:00
Thomas Jarosch
7361a433d0 ARM unwinder for thumb: Fix broken SUB opcode
Detected while looking through the code.
Patch submitted upstream.

Change-Id: I7ebe7b5f5947cf3df1b054d545dba92829f21b99
2015-01-12 19:26:23 +01:00
Thomas Jarosch
fa592cc725 ARM unwinder: Add missing 'register' variable in debug output
Also fix a wrong format specifier for an unsigned variable.
Detected by cppcheck, patch submitted upstream.

Change-Id: I9b84d91eeb242ed77b53ecc16252c5b35190bb9f
2015-01-12 19:15:08 +01:00
Thomas Jarosch
1589b28afc ARM unwinder: Add missing va_end() call.
Detected by cppcheck, patch submitted upstream.

Change-Id: Ieeec9d2e7e2c22d64c94936958f5a4ff02d3548b
2015-01-12 19:10:24 +01:00
Thomas Jarosch
2a3e1628a5 Limit more variables to file scope
Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
2015-01-11 21:40:51 +01:00
Amaury Pouly
dc127f213c Clarify usb_powered() and fix some code.
Either by mistake or because its meaning changed, usb_powered() doesn't mean
what the name suggest, so clarify its meaning by renaming it to usb_powered_only.
So use of usb_powered() are replaced by usb_inserted() when it makes more sense.

Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8
Reviewed-on: http://gerrit.rockbox.org/1097
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:32 +01:00
Thomas Jarosch
f91434cc7b Fix yellow
Change-Id: I8685198c208b5324b09b5ad59f7379502e9ed977
2015-01-05 19:09:33 +01:00
Thomas Jarosch
fdd4aef340 Make thirty functions static to reduce binary size
If any of those functions should be (unused) API functions,
they can easily be turned back once really needed.

Detected using a new cppcheck check that
uses the internal symbol database to catch
functions that are only used in the current file.

Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
2015-01-05 18:44:36 +01:00
Thomas Jarosch
e7c282fed7 More standard conforming codec_realloc()
- Leave original ptr untouched if allocation fails
  (bail out early)
- Behave like malloc() in case ptr is NULL

Change-Id: Ib854ca19bd0e069999b7780d2d9a533ece705add
2014-12-27 17:33:24 +01:00
Thomas Jarosch
55a5aab97c Add newlines at the end of the file
Quiet maemo's gcc 4.2.1 compiler warning.

Change-Id: I35dfb2c0cb269b05edd62adf71fe0308a4b9ba5b
2014-12-17 23:34:48 +01:00
Michael Giacomelli
d924c83066 Fix warning in WMA Pro and remove a c++ comment.
Change-Id: Id9b50c1fdeca4d87f158da717de8958330f027ef
2014-11-28 23:04:50 +01:00
Michael Giacomelli
aa2c55e105 Fix FS#13009.
This file revealed several problems with our ASF parser:

1)  The packet count in the ASF was actually a 64 bit value,
leading to overflow in very long files.

2)  Seeking blindly trusted the bitrate listed in the ASF header
rather than computing it from the packet size and number of packets.

Fix these problems and fix a few minor issues.

Change-Id: Ie0f68734e6423e837757528ddb155f3bdcc979f3
2014-11-28 22:30:05 +01:00
Marcin Bukat
da417ab93d fix yellow
Change-Id: Ie3aa9b208e3f4f17d4d02f11f69839e9b381217d
2014-09-22 10:55:11 +02:00
nialv7
d392da8002 metadata: Add cuesheet embedded in ape tags.
Change-Id: I5d9e731c3ea786fb910afbb0a5201fc68dcab9f9
Reviewed-on: http://gerrit.rockbox.org/965
Reviewed-by: Nick Peskett <rockbox@peskett.co.uk>
Tested: Nick Peskett <rockbox@peskett.co.uk>
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2014-09-22 10:20:39 +02:00
Michael Sevakis
5d31d3c3bc Fix last warning for Warble
Unused result warnings will have to be dealt with separately.

Change-Id: I00c45e28d4d43a5376745036e650ff8df576c2db
2014-08-30 01:50:22 -04:00
Michael Sevakis
da4938d6ee Get the last errors I hope!
Change-Id: Ia285b95480cc9ac6494b745d80892c4b1b912341
2014-08-30 01:29:18 -04:00
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