summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec
AgeCommit message (Collapse)AuthorFilesLines
2024-02-02Remove ATRAC3 specific fields (channels, extradata_size) from mp3entryRoman Artiukhin11-35/+22
Also fixes typo of using never initialized id3->channels in wav metadata (introduced in 2d1937a1) Change-Id: I28cddec2b9d9bd1e756ffaa004b4f6e8528a7566
2024-01-24Codecs: mpa: Use both time and offset when resuming filesRoman Artiukhin1-1/+8
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-24Codecs: mpa: Improve seek in large mp3 vbr filesRoman Artiukhin1-13/+16
Use current position as toc mark and use it if it gives better accuracy. Continuation of 3883c978 Change-Id: Ic6e8192fc43061f3c07128486dbefba7382be5ce
2024-01-21Codecs: aac: Improve ADTS stream detectionRoman Artiukhin2-22/+34
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-12Codecs: mp4: Re-Fix loading tracks with metadata at the end of fileRoman Artiukhin1-4/+6
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
2023-12-31Codecs: mp4: Disable SBR decoding for PP5002 - PP5022 platformsroman.artiukhin4-4/+15
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-23Codecs: mp4: Fix loading tracks with metadata at the end of fileroman.artiukhin1-2/+1
Fixes FS#13402 Change-Id: Iafb21787e8f042e913c86b249bb2552cfdf4f4a8
2023-11-02Codecs: mp4: Fix sign overflow in seek by offsetroman.artiukhin1-1/+1
Change-Id: I52f536ae959f989c3dc70a50cb802eb1b8615642
2023-10-31Fix rewind on resume is applied for skip length across tracks action after ↵roman.artiukhin1-0/+1
auto frequency switch Add resume adjustments flag in mp3entry struct which is required for proper AUDIO_START_RESTART resume handling Fixup for 4fb37ecb (#5196) Change-Id: Ie9ecfe2b637bba38e442066333d71eeff01030ad
2023-10-03Codecs: mp4: Fix seek to end of trackroman.artiukhin2-0/+4
Fix possible crash due to out of bound access. Fixes FS#13371 Change-Id: I90d28fa89ceb22e6561d33abc5f2b4c7f32d323c
2023-10-02Codecs: mp4: Ignore decode errors till next chunk present in lookup_tableroman.artiukhin1-1/+5
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-01Remove structec API from codecsAidan MacDonald3-15/+23
Change-Id: I1e67582c0521e6354b0175a11fcf690ae40dbd88
2023-09-29Codecs: mp4: Skip FOURCC filetype chunk checkroman.artiukhin2-32/+8
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-26codec.h fix ifdef for older compilersWilliam Wilgus1-1/+1
elifdef appears to be finally supported in C23 elif defined() works everywhere Change-Id: I8ac6c215bedc81cc9ea8f79850be40cef131594b
2023-09-26Support per file logging with LOGF_ENABLE in codecsroman.artiukhin2-16/+4
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-22Codecs: mp4: Fix seek in files with single element in lookup_tableroman.artiukhin2-8/+8
lookup_table offset shouldn't be zero terminated. And fix possible out of bound access. Change-Id: I212a5fcc1868a2ca519b0052b170e836276fe9de
2023-09-20Codecs: mp4: Fix sbr detections for some filesroman.artiukhin1-6/+7
Use logic from libfaad/mp4.c AudioSpecificConfig2 for sbr detection Fixes FS#12856 Change-Id: I235aa27830aa99f1307b303347f7affe7deafbe3
2023-09-20Codecs: mp4: Accurate seek in large files with small lookup_tableroman.artiukhin3-6/+25
Read sample_byte_sizes table on demand when it can't be cached Change-Id: I2191be63ceebfd8b16e1e973e13c5b51986b6564
2023-09-19alac: Fix warnings introduced in ac82a653bbSolomon Peachy1-6/+6
Change-Id: I96fc2b8637cb95c5bd14a6d77fc4b2339c4acd49
2023-09-19libm4a: Fix warnings introduced in 001a338e51Solomon Peachy3-34/+34
Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5
2023-09-19Codecs: mp4: Reuse lookup_table index from seek in m4a_check_sample_offsetroman.artiukhin4-10/+12
Change-Id: If2fc3038ce8db8ddf2991406a5cce294a857eadc
2023-09-19Codecs: mp4: Optimize m4a_check_sample_offsetroman.artiukhin2-12/+10
Make optimization from 2358fabb actually work. Fix potential out of bound access. Remove redundant zero offset check. Change-Id: I0a0ba04670b612d410ac17a761bd08c2915721b9
2023-09-18Codecs: mp4: Small cleanuproman.artiukhin1-4/+1
Remove unnecessary frame modification Change-Id: I884152a66477efea7cfcadc638f55352ad75fc41
2023-09-18Codecs: mp4: Improve support for long files. Part 2roman.artiukhin2-42/+38
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-15Codecs: mp4: Fix seek in very large filesroman.artiukhin4-10/+11
Samples count requires 64 bit Change-Id: Ia54be57d7d15b3db19dbc29ff8a06671594abb4b
2023-09-15Codecs: mp4: metadata: Fix time length in very large filesroman.artiukhin2-6/+4
Fix 40 hours long book reported as 14 hours due to samples overflow Change-Id: I5988d4492b1f51081fff921180de6fe384ab5f4f
2023-09-09Codecs: mp4: Improve support for long files, prevent endless loopWilliam Wilgus1-2/+2
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-06Codecs: mp4: Improve support for long filesroman.artiukhin1-8/+27
Reduce lookup_table (seek accuracy) till it fits on device Fixes FS#13049 Change-Id: I934de500a4383e17b82821afa2e0396a27061707
2023-09-06Codecs: mp4: Skip unknown chunksroman.artiukhin1-1/+2
Needed for opening some m4b books (see FS#13049) Change-Id: Id289451e6b2b8a7ad1f6b9f00ef512ab9692383d
2023-08-28Fix MP3 VBR seek jumps in wrong direction for long filesroman.artiukhin1-2/+10
Fix jumps in the wrong direction by seeking relative to the current position Change-Id: I5ca3d5bcb256dd8fb1cd17e6149878190571d359
2023-07-02libmusepack: Fix inconsistent definition of an array sizeSolomon Peachy1-1/+1
Change-Id: If91eed5a0cbce44723e9581dce7de02e644f7e3e
2023-03-23Fix 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
2023-03-23Using ARM Unified Assembler LanguageChris Chua5-18/+22
Change-Id: Iae32a8ba8eff6087330e458fafc912a12fee4509
2023-03-21plugins: 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: https://hvsc.csdb.dk/MUSICIANS/P/Page_Jason/Eighth.sid https://hvsc.csdb.dk/MUSICIANS/J/Jeff/Blowing.sid 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