1
0
Fork 0
forked from len0rd/rockbox
Commit graph

201 commits

Author SHA1 Message Date
Solomon Peachy
43dfa7d084 opus: Re-add IRAM hints to some constant tables
Was accidently disabled in 14c6bb798d
(in January 2019)

See 8e8671a73e for the benchmarks.

Change-Id: I3d558f8cfc041a14d0a1e55da3b042c7d01089e8
2024-07-10 09:23:33 -04:00
Solomon Peachy
67b5fa06d5 opus: Re-enable Coldfire ASM optimizations
Was accidently disabled in 14c6bb798d
(in January 2019)

(Had to make a minor change due argument differences)

Change-Id: If7c128cdeaa9ed82b2b33de1b75ca7cc4a95abdd
2024-07-10 09:23:33 -04:00
Solomon Peachy
eb8f6e578e libspeex: Fix up two build regressions in 547b6a570
Broke rbspeex build if we weren't using system libspeex
2024-06-21 16:38:45 -04:00
Solomon Peachy
547b6a570d codecs: Update libspeex from 1.2beta3 to 1.2rc1
This is a relatively minor bump, but it's the first step towards
bringing this current.

Change-Id: Iab6c9b0c77f0ba705280434ea74b513364719499
2024-06-20 07:08:35 -04:00
Solomon Peachy
6f4d0b7eb1 m4a: Fix a warning under GCC 8.
...Not sure why this just cropped up now.

Change-Id: I2318ee929fb5fddbf033680d92f21bba73631db6
2024-06-19 09:22:44 -04:00
Roman Artiukhin
e80cf93b67 Codecs: debugging: Disable compiler optimizations when DEBUG is defined
Change-Id: I6a65a2f650c4c7e0cde6165e8f46df1f3a5fd855
2024-06-18 20:43:35 -04:00
Solomon Peachy
73f40d8a23 build: Experimental LTO support, phase one
* Only codecs and plugins are enabled
 * Only native builds (so far)
 * Only tested on xDuoo X3 (MIPS, monochrome)
 * opus & speex generate some warnings
 * Significant compile time impact

Change-Id: I519b0d179631a54b2103cd67225bd5ec6ad3bd2f
2024-06-18 08:15:47 -04:00
Solomon Peachy
8c86fb6da0 arm: Use -masm-syntax-unified when compiling with gcc8 or newer
Annoyingly, this makes all of the '.S' files we compile get treated as
divided syntax, so we need to make the syntax in them explicit.

Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf
2024-05-08 21:45:42 -04:00
Solomon Peachy
98971604c7 Correct one of the GCC14 warning workarounds
(Accidentally pushed an out-of-date commit)

Change-Id: I53a85420349d6fc12831a481becc2dd1617a8ed9
2024-04-25 20:49:56 -04:00
Solomon Peachy
1922ac1aac Temporary fix for build warnings under GCC 14.0.1
...Both appear to be false positives, and will hopefully be resolved
in a later GCC point release.  I will periodically revisit this.

Change-Id: I7388932f5be052d39dd8c4195b438bf275dd72d9
2024-04-25 19:19:38 -04:00
Roman Artiukhin
19f21a2b3f Codecs: mp4: Enable FAAD_STATIC_ALLOC
Allocates several SBR + PS arrays and variables statically
Prevents out of memory exceptions for long audiobooks

Note from original commit a602f46d why it was disabled:
For now malloc is not fully removed but used by a few arrays needed for AAC-HE SBR+PS only. Reason to keep malloc is to have this amount of memory available for AAC-LC files which might require large m4a tables.

But now with "shrinkable" seek table 2c6dfd06 it's no longer a critical issue for aac-lc files (we just load less seek entries) but might be critical for aac-he files.

Fixes issue described here https://www.rockbox.org/tracker/task/13049#comment44587

Change-Id: Id9c20bad4c46034299a2a4de95d41c807b3af412
2024-03-28 08:25:02 -04:00
Roman Artiukhin
76ec55cc49 Remove ATRAC3 specific fields (channels, extradata_size) from mp3entry
Also fixes typo of using never initialized id3->channels in wav metadata (introduced in 2d1937a1)

Change-Id: I28cddec2b9d9bd1e756ffaa004b4f6e8528a7566
2024-02-02 09:36:53 -05:00
Roman Artiukhin
be16edc94b Codecs: mpa: Use both time and offset when resuming files
The supplied time may be more accurate than the calculated time from the bitrate (can be quite inaccurate for long vbr files and even for cbr due to padding)

Change-Id: I1f8291eab45fbd91a161b51776c391a0f7886a5c
2024-01-24 18:19:33 +02:00
Roman Artiukhin
1122cae028 Codecs: mpa: Improve seek in large mp3 vbr files
Use current position as toc mark and use it if it gives better accuracy.

Continuation of 3883c978

Change-Id: Ic6e8192fc43061f3c07128486dbefba7382be5ce
2024-01-24 12:35:07 +02:00
Roman Artiukhin
d50470bc7d Codecs: aac: Improve ADTS stream detection
Captured ADTS streams might start from some garbage data from previous frame. We should check for sync errors even for first frame.

Change-Id: I70171298b79713aeedf9fa2e6098a03063487649
2024-01-21 20:08:04 -05:00
Roman Artiukhin
3080892d21 Codecs: mp4: Re-Fix loading tracks with metadata at the end of file
first_frame_offset is not set for mp4 files so seeking to it doesn't make any sense. It can lead only to additional re-buffer request. So instead let's just allow seek back for m4a_check_sample_offset check. And do seek_buffer(0) before reading metadata (fixes possible hang introduced in fc65bdab)

Change-Id: Ia7fae14b0137d73b5e263390be5f143deb7ca789
2024-01-12 18:30:30 +02:00
roman.artiukhin
4cd65b9d97 Codecs: mp4: Disable SBR decoding for PP5002 - PP5022 platforms
Includes ipod video (5G) and earlier models, sansa c200 and others players not capable to decode AAC-HE.

Allows to play backward compatible files as AAC-LC.

Change-Id: Ic9f5c0f255d9a4308c3414d402f8f27f4328ca94
2023-12-31 20:44:15 -05:00
roman.artiukhin
fc65bdab4e Codecs: mp4: Fix loading tracks with metadata at the end of file
Fixes FS#13402

Change-Id: Iafb21787e8f042e913c86b249bb2552cfdf4f4a8
2023-12-23 14:35:56 -05:00
roman.artiukhin
2030d681e4 Codecs: mp4: Fix sign overflow in seek by offset
Change-Id: I52f536ae959f989c3dc70a50cb802eb1b8615642
2023-11-02 09:40:56 +02:00
roman.artiukhin
69f62b7891 Codecs: mp4: Fix seek to end of track
Fix possible crash due to out of bound access.

Fixes FS#13371

Change-Id: I90d28fa89ceb22e6561d33abc5f2b4c7f32d323c
2023-10-03 18:36:22 +03:00
roman.artiukhin
7616822fbb Codecs: mp4: Ignore decode errors till next chunk present in lookup_table
In files with gaps between chunks and reduced lookup_table we can't properly detect all gaps in m4a_check_sample_offset. So just ignore decode errors till next chunk present in lookup_table

Change-Id: I317864dce6a2251cdb6ddb8c0ad4d7c1640cb7a1
2023-10-02 12:54:57 -04:00
roman.artiukhin
d05f6aac2d Codecs: mp4: Skip FOURCC filetype chunk check
Instead of FOURCC it needs ignore-case text match. Also value can contain \0 ('m4a\0' instead of expected 'm4a ').But let's simply skip it and let decoder handle it.

Change-Id: I87eefcabbc9010481286257c26cee09e61d1221c
2023-09-29 08:21:27 -04:00
William Wilgus
4c533475d8 codec.h fix ifdef for older compilers
elifdef appears to be finally supported in C23
elif defined() works everywhere

Change-Id: I8ac6c215bedc81cc9ea8f79850be40cef131594b
2023-09-26 15:03:13 -04:00
roman.artiukhin
ec2c507e60 Support per file logging with LOGF_ENABLE in codecs
Codecs mostly use custom LOGF define for logging (i.e. see aac.c). Now such logging can be enabled in single file with #define LOGF_ENABLE

Change-Id: I36312fbcd2d9166fb1fe5ead31e7354342d8828d
2023-09-26 08:38:31 -04:00
roman.artiukhin
a45204f5df Codecs: mp4: Fix seek in files with single element in lookup_table
lookup_table offset shouldn't be zero terminated.
And fix possible out of bound access.

Change-Id: I212a5fcc1868a2ca519b0052b170e836276fe9de
2023-09-22 10:37:38 -04:00
roman.artiukhin
57409f52d5 Codecs: mp4: Accurate seek in large files with small lookup_table
Read sample_byte_sizes table on demand when it can't be cached

Change-Id: I2191be63ceebfd8b16e1e973e13c5b51986b6564
2023-09-20 11:43:39 +03:00
Solomon Peachy
3dbf5a97ad alac: Fix warnings introduced in ac82a653bb
Change-Id: I96fc2b8637cb95c5bd14a6d77fc4b2339c4acd49
2023-09-19 12:36:02 -04:00
Solomon Peachy
ac82a653bb libm4a: Fix warnings introduced in 001a338e51
Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5
2023-09-19 11:47:38 -04:00
roman.artiukhin
001a338e51 Codecs: mp4: Reuse lookup_table index from seek in m4a_check_sample_offset
Change-Id: If2fc3038ce8db8ddf2991406a5cce294a857eadc
2023-09-19 11:13:19 -04:00
roman.artiukhin
ef7d6009b4 Codecs: mp4: Optimize m4a_check_sample_offset
Make optimization from 2358fabb actually work.
Fix potential out of bound access.
Remove redundant zero offset check.

Change-Id: I0a0ba04670b612d410ac17a761bd08c2915721b9
2023-09-19 11:13:19 -04:00
roman.artiukhin
9242e4cadb Codecs: mp4: Small cleanup
Remove unnecessary frame modification

Change-Id: I884152a66477efea7cfcadc638f55352ad75fc41
2023-09-18 11:29:21 -04:00
roman.artiukhin
6acb6446e6 Codecs: mp4: Improve support for long files. Part 2
Don't store sample_to_chunk table and read data on demand instead (it's required only once for building lookup table). It allows to store 2x bigger lookup table.

Change-Id: Ida79d0c281040300d6561e124fe10ebacb0e4679
2023-09-18 11:29:05 -04:00
roman.artiukhin
27aa95afcb Codecs: mp4: Fix seek in very large files
Samples count requires 64 bit

Change-Id: Ia54be57d7d15b3db19dbc29ff8a06671594abb4b
2023-09-15 09:08:18 -04:00
William Wilgus
6b0e3fe775 Codecs: mp4: Improve support for long files, prevent endless loop
pretty unlikely but I think in a memory exaustion scenario
you might roll the uint8 over to zero and crash

Change-Id: If73dc64484f2d363446be068aa7bf8025407a2a7
2023-09-09 21:16:35 -04:00
roman.artiukhin
2c6dfd06a6 Codecs: mp4: Improve support for long files
Reduce lookup_table (seek accuracy) till it fits on device

Fixes FS#13049

Change-Id: I934de500a4383e17b82821afa2e0396a27061707
2023-09-06 16:49:30 -04:00
roman.artiukhin
a190d0ca9c Codecs: mp4: Skip unknown chunks
Needed for opening some m4b books (see FS#13049)

Change-Id: Id289451e6b2b8a7ad1f6b9f00ef512ab9692383d
2023-09-06 16:49:23 -04:00
roman.artiukhin
3883c978ab Fix MP3 VBR seek jumps in wrong direction for long files
Fix jumps in the wrong direction by seeking relative to the current position

Change-Id: I5ca3d5bcb256dd8fb1cd17e6149878190571d359
2023-08-28 14:04:56 -04:00
Solomon Peachy
102dc49ed9 libmusepack: Fix inconsistent definition of an array size
Change-Id: If91eed5a0cbce44723e9581dce7de02e644f7e3e
2023-07-02 20:45:16 -04:00
Aidan MacDonald
58b2e45782 Fix unified syntax in ARM inline assembly
GCC 4.9 always emits assembly with divided syntax. Setting unified
syntax in inline assembly causes the assembler to complain about
GCC's generated code, because the directive extends past the scope
of the inline asm. Fix this by setting divided mode at the end of
the inline assembly block.

The assembler directives are hidden behind macros because later
versions of GCC won't need this workaround: they can be told to
use the unified syntax with -masm-syntax-unified.

Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8
2023-03-23 18:16:33 +00:00
Chris Chua
86429dbf1e Using ARM Unified Assembler Language
Change-Id: Iae32a8ba8eff6087330e458fafc912a12fee4509
2023-03-23 13:28:22 -04:00
Aidan MacDonald
d40a598970 plugins: Simplify plugin/codec API versioning
Replace the minimum version bound with a check on the size of
the API struct. The version only needs to be incremented for
ABI breaking changes. Additions to the API won't need to touch
the version number, resulting in fewer merge conflicts.

Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f
2023-03-21 16:23:54 -04:00
Solomon Peachy
23cb6139bd SID: Disable SID on 2MB targets, as cRSID needs a lot of RAM.
Also add a note that SID might not play in realtime on all targets

Change-Id: Ic14b20a7c1427e31e38204ae3ecff6bd235ec1b4
2023-02-07 11:25:02 -05:00
Wolfram Sang
70ce734ece codec: sid: use cRSID as a library for playing SID files
Change-Id: Iee70933e47ff8df8f26c9a63112de4da4a8e6c17
2023-02-07 09:19:32 -05:00
Wolfram Sang
15c0f0576e codec: sid: split cRSID header into a public and a private header
Needed to compile cRSID as a proper library.

Change-Id: I276967f46037bd65db1ff38985a781183fc26a00
2023-02-07 09:19:32 -05:00
Wolfram Sang
e8135fea5a codec: sid: add cRSID-1.0 for 21st century SID playback
Plain import of the library parts first. Adaptions to Rockbox will
follow. A *lot* of kudos go to Mihaly Horvath for creating this library
from his already lightweight cSID-light, mainly for Rockbox. Besides a
lot of other things, he made his algorithms integer-only and
significantly improved the C64 emulation, so finally RSIDs could be
played as well as PSIDs. TinySID was nice for what it is, but this is a
quantum leap in SID playback quality for Rockbox. Check for example:

https://hvsc.csdb.dk/MUSICIANS/P/Page_Jason/Eighth.sid
https://hvsc.csdb.dk/MUSICIANS/J/Jeff/Blowing.sid

Change-Id: I353e12fbfd7cd8696b834616e55743e7b844a73e
2023-02-07 09:19:32 -05:00
Aidan MacDonald
969e1ef6cd Bump codec API version, remove dummy configure loop in dsp_init()
It turns out removing DSP_INIT broke the codec ABI and caused
old codecs to crash; the loop and mdelay() was a red herring.

This reverts commit 541960a110.

Change-Id: I020d826e7b4beb006d093d9c3d4f45fa5eaac717
2023-01-18 17:52:55 +00:00
Aidan MacDonald
56442f6b7f rbcodec: Fix FLAC out of bounds read
Commit 6bcd830490 ported an optimization to decode_subframe_fixed()
from FFmpeg (upstream commit 08965b22e2). This contains an out of
bounds read, which doesn't affect the decoder output, but makes ASAN
complain.

FFmpeg fixed the out of bounds read (upstream commit 0ec7b71de8) but
that appears to increase code size a lot.

Inlining the initialization of a, b, c, d into the switch produces
similar code as the non-bounds-checked version with only a handful
of instructions of overhead (checked on MIPS & ARM).

Change-Id: I053fac4efc4676b133eb7545c80e23f37fb00d86
2023-01-15 16:11:28 -05:00
William Wilgus
9367ef1ed6 [BugFix] Fix some Shif related UB -- ASAN
these are the low hanging fruit identified by ASAN

cast the byte values before shift

Change-Id: Ifc5645354a10c15ccd09d1343e1705857a51e011
2023-01-04 22:00:25 -05:00
Aidan MacDonald
2f278af760 codecs: alac: Improve resume accuracy and clean up rounding errors
Resume by offset was obviously inaccurate for ALAC -- it tried
to convert the offset to an elapsed time using the approximate
bitrate, which is going to be wrong for VBR files. This became
a problem since commit 26ffcd8f9f restored the ability to resume
by offset.

It turns out that m4a_seek_raw() has terrible resolution since
it can only seek to chunk boundaries, and lies about the real
sample position; basically the same issue that affected seeking
described in commit 4dd3c2b33e. Resuming by offset is still not
very accurate because of this. Prefer to resume by time first,
which is normally highly accurate (and never worse than offset)
but use the file offset if it's the only thing we have.

There were a couple time calculations still using 32-bit math,
so clean those up too to reduce issues due to rounding errors.

Change-Id: Idd3bccd67505f4e59e784d92e45ea80a273975bb
2022-11-16 06:48:28 -05:00
Aidan MacDonald
ea61347a0b codecs: aac: Prefer to resume by time instead of offset
m4a_seek_raw() is relatively inaccurate, so time-based resume
should be preferred.

Change-Id: I959ef165f9a99d12deb804c13d20413c1cecf867
2022-11-16 06:48:22 -05:00