path: root/lib/rbcodec
AgeCommit message (Collapse)AuthorFilesLines
9 daysFix unified syntax in ARM inline assemblyAidan MacDonald1-3/+6
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
9 daysUsing ARM Unified Assembler LanguageChris Chua5-18/+22
Change-Id: Iae32a8ba8eff6087330e458fafc912a12fee4509
11 daysplugins: Simplify plugin/codec API versioningAidan MacDonald1-13/+15
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-02-07SID: Disable SID on 2MB targets, as cRSID needs a lot of RAM.Solomon Peachy2-1/+3
Also add a note that SID might not play in realtime on all targets Change-Id: Ic14b20a7c1427e31e38204ae3ecff6bd235ec1b4
2023-02-07metadata: sid: allow RSIDs as wellWolfram Sang1-1/+1
cRSID also allows to play RSIDs (hence the name of the library). So, allow them as well. Change-Id: Iae8f0ac083ed714771767a4c23f5a09bad637208
2023-02-07codec: sid: use cRSID as a library for playing SID filesWolfram Sang5-1272/+75
Change-Id: Iee70933e47ff8df8f26c9a63112de4da4a8e6c17
2023-02-07codec: sid: split cRSID header into a public and a private headerWolfram Sang4-165/+176
Needed to compile cRSID as a proper library. Change-Id: I276967f46037bd65db1ff38985a781183fc26a00
2023-02-07codec: sid: add cRSID-1.0 for 21st century SID playbackWolfram Sang12-0/+2525
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: Change-Id: I353e12fbfd7cd8696b834616e55743e7b844a73e
2023-01-18Bump codec API version, remove dummy configure loop in dsp_init()Aidan MacDonald3-13/+2
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 541960a11061213f682d67bb036f861b2605f9d3. Change-Id: I020d826e7b4beb006d093d9c3d4f45fa5eaac717
2023-01-15rbcodec: Fix FLAC out of bounds readAidan MacDonald1-7/+12
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"Fix" warble build warnings 800bc000a0Aidan MacDonald1-1/+1
Not really sure how best to deal with the warnings (redefinition of ARRAYLEN, etc.) short of splitting things out of system.h but this is good enough for now. Change-Id: Ibea9f693d128c7995f564f0f5c81d572462a5553
2023-01-15buflib: Prep for multiple backend support, rename to buflib_mempoolAidan MacDonald1-1/+1
Rename the current buflib implementation to buflib_mempool. Change-Id: Iefdf74be1f7d8fcd19e6ce2289c3d1459b54d013
2023-01-13Remove buflib allocation names, part twoAidan MacDonald2-2/+2
Remove allocation names from the buflib API and fix up all callers. Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-12rbcodec/dsp: restore configure loop in dsp_init() (FS#13386)Aidan MacDonald2-0/+11
It seems removing this causes a crash on the Clip+ when playing any file. Appears to be a timing-related issue as replacing the loop with an mdelay() also fixes it. Needs further investigation to identify the real cause of the problem, see FS#13386. Change-Id: Ia93a2887a79b376de50563d6bb3bbc79cee11a1c
2023-01-04[BugFix] Fix some Shif related UB -- ASANWilliam Wilgus2-13/+19
these are the low hanging fruit identified by ASAN cast the byte values before shift Change-Id: Ifc5645354a10c15ccd09d1343e1705857a51e011
2022-12-23rbcodec dsp: Refactor DSP init routines, restore INIT_ATTRAidan MacDonald10-35/+62
Refactor DSP init routines so there is a dedicated init function for the stages that need it. Remove the DSP_INIT configure message. This allows the init code to be safely marked INIT_ATTR, saving a bit of code size, and allowing the linker to verify that there are no unsafe references to the init routines. Change-Id: I1702f0f579bbb300a6fe7d0e67b13aa2e9dd7f8a
2022-12-22rbcodec dsp: Replace enum dsp_ids arguments with unsigned intAidan MacDonald8-26/+18
Because casting to and from "enum dsp_id" just adds noise, change everything to unsigned int. Change-Id: I52a7ae55f406e673d5b811b29657fcdc4b62ab10
2022-12-22rbcodec dsp: Move dsp_sample_io_configure() to its own fileAidan MacDonald5-103/+129
Makes dsp_sample_input.c a bit less messy, and dependencies are more explicit. There's possibly a minor loss of inlining but it isn't a big deal. Change-Id: I30f923a0ca758f2b113d32852d1f65586dff0cd1
2022-12-18Fix red in 8165a6c245Aidan MacDonald1-1/+1
Change-Id: I939b40492902525c911c063c66b28529b7d0842f
2022-12-18rbcodec dsp: Remove INIT_ATTR from the DSP libraryAidan MacDonald8-20/+15
All of these are technically unsafe cross-section references but most aren't reported by the linker, probably due to inlining. In practice there was no problem because the affected code was only run at init time anyway. For now, remove INIT_ATTR until the init code can be refactored to avoid the problematic references. This should also save code size by moving more code to the init section. dsp_init() gets to keep its attribute because it's already OK. Change-Id: Idc9ac0e02cb07f31d186686e0382275c02a85dbb
2022-12-16[Bug Fix] haas surround use delay_ms instead of index surround_strengthWilliam Wilgus2-33/+24
this appears to be an old bug rather than using an index use delay_ms directly Change-Id: Ia4d0bf8eb8030d6ded08354abc31cc7ddefdda99
2022-12-11[Bug Fix] dsp_proc_enable init race / crashWilliam Wilgus2-2/+9
haas surround is causing a seg fault it appears process is null see for details when the low_latency_callback is enabled it happens less frequently lets default to an empty process that way there are no NULL pointers to call Change-Id: Ib72ba1a58cbb20cef04b5ea50964adadeee74a75
2022-11-17strlcpy finish cleanupWilliam Wilgus1-1/+1
remove strlcpy & strlcat from string.h document suspicious strlcpy call convert strlcat.h users to string-extra Change-Id: I313e75db86385c0e6d1aee75d252093be4935f60
2022-11-16codecs: alac: Improve resume accuracy and clean up rounding errorsAidan MacDonald1-31/+33
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-16codecs: aac: Prefer to resume by time instead of offsetAidan MacDonald1-5/+5
m4a_seek_raw() is relatively inaccurate, so time-based resume should be preferred. Change-Id: I959ef165f9a99d12deb804c13d20413c1cecf867
2022-11-15Fix last of red for strmemccpyWilliam Wilgus1-0/+1
Change-Id: I76c421d938a879e57018e3f9706edf77c03de1b5
2022-11-01codecs: mpa: Improve seek & resume accuracy for VBR filesAidan MacDonald1-55/+32
The codec used 32-bit math for elapsed time <-> file position calculations. The rounding errors seem to be the cause of poor seek/resume accuracy on long VBR files; switching to 64-bit math makes things much better. Change-Id: Iba638d9e031a891022510c31c141cc4541e3f149
2022-11-01Refactor to reuse seek code for resume by timeroman.artiukhin1-36/+37
It fixes Playback/Bookmarks Resume for long vbr mp3 files It also fixes resume by time for asf files. As a replacement for Change-Id: Iaa59b5862385f5fe91fdc2fb0b1fde8ce75c0b54
2022-10-13Revert "RFC: Get rid of mpegplayer plugin"Solomon Peachy3-4/+30
This reverts commit d25d24812e8120c0eb133a412287ac030eb185c9. Change-Id: I1563223e343fb1e2eda72a45823b38350025ff93
2022-10-02RFC: Get rid of mpegplayer pluginSolomon Peachy3-30/+4
It might have made sense once upon a time, but in today's world... Change-Id: I5d638e6f7a2308c50ab12bd901338f02cf426aae
2022-07-11Fix a couple of warnings uncovered by GCC12Solomon Peachy1-0/+2
Change-Id: Ib628a27bfc6f95a822e46b931ccfbed90f41b122
2022-06-21fix uninitialized warning in libopusWilliam Wilgus1-1/+1
likely this is truly a bug but I imagine much worse things happen before this point in that case Change-Id: If78465cf2ae1e5cf38ad7f087dd436b888bc9996
2022-05-03add const to const * stringsWilliam Wilgus2-5/+5
I don't think this will amke any difference except maybe for hosted ports Change-Id: I84f898aea92a6963901a6d889dd18b63f24c9a41
2022-05-02codecs: m4a: improve seek accuracyAidan MacDonald3-53/+127
Seeking doesn't work well in M4A files with very few chunks due to the seek method used (chunk based using the info in the 'stco' atom). According to libm4a/demux.c the expected seek resolution using this method is 1/4 to 1/2 seconds. However, ffmpeg generates files with a 1 megabyte chunk size, so the resolution is much worse than expected on some files: around 30-40 seconds at 256kbps. There was a bug with the seek position reported back to Rockbox: the codec pretended it could seek exactly to the requested sample, but it would only seek to the start of a chunk. This could leave the UI in a confusing state because the real playback position was different from what the elapsed time showed. Fix this by recalculating the reported sample position using the chunk start. To fix the low seek accuracy, use the table in the 'stsz' atom to skip individual packets within a chunk. This is very accurate, but it takes a lot of RAM to allocate the table. Currently the table is not allowed to use more than half of the codec RAM, which should suffice for short files on most targets. On files where the table is too large the codec will fall back to the less accurate chunk-based seek method. Change-Id: Ide38ea846c1cdd69691e9b1e1cd87eb0fa11cf78
2022-04-20buffering: remove bufgettail/bufcuttailAidan MacDonald2-39/+0
These operations can only be used in limited circumstances and have exactly one user. bufgettail especially seems of dubious value; how often do you need to read N bytes from the end of a file without changing the file position? strip_tags() was the only function using them, to strip off ID3v1 and APE tags off the end of buffered tracks. This would save only 32-192 bytes per track -- if the container format uses APE/ID3v1. It hardly seems worth the effort. Change-Id: I8fc3c1408517eda6126e75e76d76daea904b50eb
2022-04-17Fix undefined behavior that blocks compiling with UBSanAidan MacDonald1-1/+2
Left shifts are not defined in C if they would cause signed overflow, so these expressions get instrumented, which makes them unusable as switch values and triggers compile errors when compiling with UBSan. Change-Id: I0588d4be1e00ba1cfde0eac119ead368b20d10c9
2022-03-20[COV] metadata module, fix uninit warnings #2William Wilgus2-10/+12
decrease size hit of initializing asf by using a union remove init from bytes LE conversion in metadata common -- bad idea for performance Change-Id: I4514adc125e5da2b99d9f913ba74afd5f1345822
2022-03-20[COV] metadata module, fix uninit warningsWilliam Wilgus4-9/+9
Change-Id: Ifeb22642d7fb683542ff9dcfca0bc58c91ab5f38
2022-03-14metadata.c fix redWilliam Wilgus1-2/+2
comma, helpful Change-Id: Iaa352cf1b542f1b805278af8560a6927684dc8d2
2022-03-14BUGFIX string_option parsersWilliam Wilgus3-20/+30
fix bugs introduced in the switch over to using string_option instead of if else strcmp trees, embedded album art should work again skin parser had an error for 'noborder' and 'nobar' Change-Id: I957d81e5fa8467b33bbd93d63c4428c36100acca
2022-03-13replace more strcmp if then trees with string_option()William Wilgus4-51/+66
1 Change-Id: Ic89bbb2ab41068d09c7bd9caa5ba7f38749b9084
2022-03-13Warble builds define WARBLE fix metadata_common in warble buildsWilliam Wilgus1-1/+1
Change-Id: Ie5115162da5a06d917de09f75b90254bb30b7513
2022-03-13option_string clean-up and consolidate with metadata_commonWilliam Wilgus4-27/+54
Change-Id: I2649f6af37bd871fb8f181ae2f716ff0bcf1f65c
2022-03-13metadata_common.c optimize parse_tagWilliam Wilgus1-28/+50
Change-Id: I84ad404fdcc9698b9d08e6e9c37929f4b7bf569f
2021-08-11metadata/mp3data.c init vars & add sanity checksWilliam Wilgus1-2/+8
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
2021-08-11metadata/metadata_common.c check read for proper bytes readWilliam Wilgus1-10/+8
Change-Id: I25d7c20d449cde4d5cfd3f57e00ff45f4c14f60b
2021-08-11metadata/metadata_common.c WS changesWilliam Wilgus1-18/+18
Change-Id: Ieef86e94676c603a21cbb5af55e63ba628a09cdf
2021-08-11metadata/asf.c ensure variable init & add sanity checksWilliam Wilgus1-16/+28
Change-Id: If4432549b843cafb000c3fedee12184d75da595b
2021-08-11metadata/mp4.c fix small oversight / bugWilliam Wilgus1-4/+4
didn't set the genre string to null on case entry means read failure would leave genre string indeterminate add explicit NULL & leave genre uninitialized Change-Id: I1452a0b57985646c982ec80755d0df9d03745f1e
2021-08-11metadata/mp4.c check for read errors skip buffer appropriatelyWilliam Wilgus1-47/+61
WIP Change-Id: I770f0d911f7d9826e89d886892ff3913661a8151