summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs (follow)
Commit message (Collapse)AuthorAge
* Fix dangerous castsAmaury Pouly2017-02-04
| | | | | | | | | On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is not valid. In any case, one should use intptr_t and ptrdiff_t when casting to integers. This commit attempts to fix all instances reported by GCC. When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc
* Fix codecs in simulator builds on WindowsAmaury Pouly2017-01-15
| | | | | | | | | | 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
* Fix DEBUG build codecsAmaury Pouly2016-12-03
| | | | | | | | | 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
* Opus: update resume offset correctly while playing.Adam Sampson2016-09-07
| | | | | | | | | | | | | | | | | | | | 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
* Fix race conditions in parallel build.Frank Gevaerts2016-05-28
| | | | | | | | 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
* mp3_enc.c: fix MP3 recording at 32 kHz sample rateCástor Muñoz2015-07-17
| | | | | | | Fixes a buffer overflow present when MP3 is encoded at 32000 Hz sample rate, affected bitrates are 320 and 256 kbps. Change-Id: I7634e70409be9d675d47be316a42630dd3147636
* Limit more variables to file scopeThomas Jarosch2015-01-11
| | | | Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
* More standard conforming codec_realloc()Thomas Jarosch2014-12-27
| | | | | | | | - Leave original ptr untouched if allocation fails (bail out early) - Behave like malloc() in case ptr is NULL Change-Id: Ib854ca19bd0e069999b7780d2d9a533ece705add
* Fix warning in WMA Pro and remove a c++ comment.Michael Giacomelli2014-11-28
| | | | Change-Id: Id9b50c1fdeca4d87f158da717de8958330f027ef
* Fix FS#13009.Michael Giacomelli2014-11-28
| | | | | | | | | | | | | | 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
* Fix warnings from 6ed0087Michael Sevakis2014-08-16
| | | | | | | | | | | | | | 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
* libopus: use iram for more constantsNils Wallménius2014-07-13
| | | | | | | | 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
* libopus: asm C_MUL for coldfireNils Wallménius2014-07-13
| | | | | | | | | | 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
* Sync to upstream libopusNils Wallménius2014-07-13
| | | | | | | | | | | | | | | | | | | | | | 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
* libmad: Use 32bit unsigned for requantize table.Thomas Martitz2014-04-15
| | | | | | | | | | 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
* Implement time-based resume and playback start.Michael Sevakis2014-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Sync libopus to upstream release 1.1Nils Wallménius2013-12-16
| | | | Change-Id: I9fea7460fc33f60faff961b3389dd97b5191463c
* flac: fix seeking.Andrew Ryabinin2013-11-18
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Add missing #include statements.Kevin Zheng2013-10-20
| | | | | | | | | | | | | | 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>
* Simulator - encoders can now be loadedLorenzo Miori2013-10-05
| | | | | | | | | 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>
* Opus: delete two files that were moved into a subdirNils Wallménius2013-09-01
| | | | Change-Id: I54ef0dfd57fbb493ad38855767a8f5e724e5bc65
* Fix warning from a35c1b3Nils Wallménius2013-09-01
| | | | Change-Id: I0e9b2c265a6a2355dc39b1696df4c8f266d9a638
* Opus: Coldfire inline asm for comb_filter_constNils Wallménius2013-09-01
| | | | | | Speeds up decoding a 64kbps test file by 2.6MHz Change-Id: Ibeb30f37cc00a4a6f65b64851009753f40e06fc1
* Add cf asm inline for multiplication commonly used in silk.Nils Wallménius2013-08-31
| | | | | | Speeds up decoding a 16kbps test file by 4.9MHz on h300. Change-Id: I8c25431c98dfa9a1c3806a84055e0847eb77a9f1
* Put two hot silk arrays on real stack (iram)Nils Wallménius2013-08-31
| | | | | | Speeds up decoding of 16kbps test file by 16.7MHz on H300. Change-Id: I39c90e3b423ae8e2ee5c2b88c5dcec8d48807f77
* Silence spurious warningNils Wallménius2013-08-31
| | | | Change-Id: I856c722e959314c0a86e9c0a3a31cb824ddb41cc
* Sync opus codec to upstream gitNils Wallménius2013-08-31
| | | | | | | | | | | | | | | | | | | | | | | 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
* Change CODECFLAGS to a "simply-expanded" var to give the individualNils Wallménius2013-08-23
| | | | | | | | | | | | 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>
* mp3_enc: Fix early snafu with stream finish on COPMichael Sevakis2013-07-11
| | | | | | | 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
* Multithread compressing encoders on multicore targets.Michael Sevakis2013-07-09
| | | | | | | | | | | | | | | | 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
* Update software recording engine to latest codec interface.Michael Sevakis2013-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix some whitespace in files changed in following commit.Michael Sevakis2013-06-30
| | | | | | | Change-Id: Ie3f43e43076e0dcae9a10f1b0b9e4698b398acee Reviewed-on: http://gerrit.rockbox.org/492 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
* Silence some (harmless) warnings.Frank Gevaerts2013-06-16
| | | | Change-Id: I8d1278b8cfaa376d2ad5a99dd552dc980c66e1da
* SPC Codec ARMv5: I didn't have fast gauss quite right.Michael Sevakis2013-05-26
| | | | | | Fix wrapping hazard which did eventually manifest on the right file. Change-Id: I996a6efd3181b56fd172b5c3a526c7434f88bbbe
* SPC Codec: Add ARMv5 optimized code. Easy peasy.Michael Sevakis2013-05-23
| | | | | | Why? Why not? Cuts a few MHz. Change-Id: Ied5c70b1aedd255cbe5d42b7d3028bbe47aad01d
* SPC Codec: Simplify configuration and assume nothing need be disabled.Michael Sevakis2013-05-21
| | | | | | | Most SoCs are these days are fast enough for realtime BRR, gaussian interpolation and echo processing. Change-Id: I180ce8ad45242c67b5e573a406b9522098a3f12b
* SPC Codec: Need to restore a bit more data from cached waves.Michael Sevakis2013-05-21
| | | | | | 'Nuff said. Last update wasn't quite right. Change-Id: I082a79c4e0c82b968fe2375cb82ee5c3a64a208b
* Opus: fix glitch caused by 2e9aa3dNils Wallménius2013-05-21
| | | | Change-Id: I1519f3bf2cdf74f3d4741951973352b2678b7722
* Fix FS#9577 - SNES player missing tracks on certain SPCsMichael Sevakis2013-05-21
| | | | | | | | 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
* Fix 87021f7 errors. There is no this->echo_pos when SPC_NOECHO != 0.Michael Sevakis2013-05-21
| | | | | | Anyway, that's true now. Change-Id: I247ea9a10543a8b65f3e73495f0e2ea725ec533e
* SPC Codec: Refactor for CPU and clean up some things.Michael Sevakis2013-05-21
| | | | | | | | | | | | | 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
* Opus: fix seeking to start of trackNils Wallménius2013-05-19
| | | | Change-Id: I8a8604d6726304d04281671b475b2f75f9bfc0e5
* Opus: avoid allocating space for comment packetsNils Wallménius2013-05-19
| | | | | | Fixes playback of files with large embedded album art. Change-Id: I94d336e3da968a93047dd00a5fa65e4c3423a7da
* Fix opus craches with large embedded album artNils Wallménius2013-05-18
| | | | | | | | | | | | Use the tlsf malloc and friends instead of the silly codec_malloc to get actually working free and saner realloc that doesn't leak memory. Makes files with moderately sized embedded AA play on targets with large enough codec buffers and files with too large AA are now skipped rather than crashing. Fixes crash when playing example file in FS#12842. Change-Id: I06562955c4d9a95bd90f55738214fba462092b71
* Purge the usage of DSP_SWITCH_FREQUENCY.Michael Sevakis2013-05-05
| | | | | | | | DSP_SWITCH_FREQUENCY has been deprecated and the same enumerated value as DSP_SET_FREQUENCY since major DSP revisions were committed. This task should have been performed much earlier but, oh well, do it now. Change-Id: I3f30d651b894136a07c7e17f78fc16a7d98631ff
* Make fixepoint.c as a shared library (libfixedpoint.a).Michael Sevakis2013-04-26
| | | | | | | Change-Id: Icc10d6e85f890c432f191233a4d64e09f00be43d Reviewed-on: http://gerrit.rockbox.org/456 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
* Move fixedpoint.h to be accessible in /firmware.Michael Sevakis2013-04-10
| | | | | | | | | | Will need it soon enough. Combine the contents of all the various fixedpoint.h files. Not moving fixedpoint.c for now since I'm not sure where it should be and it causes some dependency issues. Change-Id: Ideacbca2ca78f9158c2b114b113c274f68e908d5
* VGM Codec: Improve time and fade behavior. Tweak minor misc.Michael Sevakis2013-03-06
| | | | | | | | | | | | | | | | | Prevents cutoff of tracks, especially short ones: * Extend looped tracks by fade length to fade at start of loop repeat. * No fade occurs for non-repeating track only having an intro. * Uses id3.tail_trim field to store fade duration. Use libGME built-in elapsed time reporting instead of custom calculation: * libGME already reports in milliseconds. * Don't advance time counter when Repeat == One. It just runs the progress over the length limit. Fix a comment about sample rate and set the reported bitrate to be accurate for 44.1 kHz stereo. Change-Id: I3ede22bda0f9a941a3fef751f4d678eb0027344c
* Fix FSB#12826 - Mini-sound burp between track skips [with WMA].Michael Sevakis2013-02-18
| | | | | | | | | | | Flush decoder state and frame out buffer upon a forced stop to prevent a short burst of stale audio from the previously decoding track from playing when skipping from one WMA track to another. Change-Id: I24c910c5dbd83caed2510db68d9e39a474332a79 Reviewed-on: http://gerrit.rockbox.org/406 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
* Deprecate the EXTRA_LIBS variable.Björn Stenberg2013-01-24
| | | | Instead specify explicit library dependencies for codecs and plugins.