Commit graph

52 commits

Author SHA1 Message Date
Michael Sevakis
7ad2cad173 Commit work started in FS#12153 to put timing/position information in PCM
buffer chunks.

* Samples and position indication is closely associated with audio data
  instead of compensating by a latency constant. Alleviates problems with
  using the elapsed as a track indicator where it could be off by several
  steps.

* Timing is accurate throughout track even if resampling for pitch shift,
  whereas before it updated during transition latency at the normal 1:1 rate.

* Simpler PCM buffer with a constant chunk size, no linked lists.

In converting crossfade, a minor change was made to not change the WPS until
the fade-in of the incoming track, whereas before it would change upon the
start of the fade-out of the outgoing track possibly having the WPS change
with far too much lead time.

Codec changes are to set elapsed times *before* writing next PCM frame because
 time and position data last set are saved in the next committed PCM chunk. 


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657
2011-08-28 07:45:35 +00:00
Magnus Holmgren
6f392693b8 AAC: Another gapless fix, this one for the end of the file. The real size of the last frame was lost in r29727, as indicated by Yusaku Inui in FS#12185, so bring it back. Now the decoded length of test1_nero.m4a (in FS#12185) only differs by one sample compared to Foobar2000 (Rockbox has one more leading sample, for some reason). Also moved a few lines to a better place.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30149 a1c6a512-1295-4272-9138-f99709370657
2011-07-17 13:00:53 +00:00
Magnus Holmgren
6c8ef19dfd FS#12161: Correct the gapless processing for AAC, so that it doesn't remove too much from the start of a track. Also simplify the logic a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30012 a1c6a512-1295-4272-9138-f99709370657
2011-06-18 15:11:30 +00:00
Andree Buschmann
d0d1a3f2f7 Remove unneeded update of ci->id3->frequency in aac and raac codec.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29794 a1c6a512-1295-4272-9138-f99709370657
2011-04-28 21:07:28 +00:00
Michael Sevakis
c537d5958e Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-04-27 03:08:23 +00:00
Andree Buschmann
a602f46d69 Rework of libfaad in several areas. Allow removal of malloc with a new define FAAD_STATIC_ALLOC (in common.h). 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. The changes make the allocation routines much smaller, better centralized and allow to move duplicated code from aac.c/raa.c to libfaad. The rework includes removal of (now and former) unused code as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29778 a1c6a512-1295-4272-9138-f99709370657
2011-04-24 20:19:05 +00:00
Andree Buschmann
2f215da9c3 Use dedicated function to internally reset aac decoder synthesis after seek.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29775 a1c6a512-1295-4272-9138-f99709370657
2011-04-24 18:56:23 +00:00
Andree Buschmann
2358fabb70 Optimization to latest aac decoder changes. Significantly reduce loop count in m4a_check_sample_offset() during standard playback. Before this change the loop count increased with each decoded chunk and for each frame.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29750 a1c6a512-1295-4272-9138-f99709370657
2011-04-19 05:55:54 +00:00
Andree Buschmann
68199cc195 Major rework of the m4a parser for aac/alac playback, seek and resume support. As a result the memory consumption was drastically reduced. This allows to play several files with long duration -- especially on low memory targets. The change builds a lookup table from m4a's sample_to_chunk[] and chunk_offset[] and completely removes the allocation of the large tables chunk_offset[] and sample_byte_size[]. To be able to remove reading and allocating sample_byte_offset[] the aac and alac decoder now buffer a fixed amount of bytes for each frame. The generated lookup table is used for seek/resume and skipping bytes in empty chunks (aac decoder only). The precision for seek/resume is somewhat lower but still equals 0.5 sec for the worst case. Fixes FS#8923.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29745 a1c6a512-1295-4272-9138-f99709370657
2011-04-18 19:12:51 +00:00
Andree Buschmann
5775159462 Refactor aac decoder as preparation for upcoming m4a changes. The aac decoder does not need to use get_sample_info() to gather frame size or the number of consumed bytes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29727 a1c6a512-1295-4272-9138-f99709370657
2011-04-16 19:39:01 +00:00
Michael Sevakis
85e40257dc Enforce that codecs wait for their metadata in a proper-ish and consistent manner. Sort of a halfway patch; best would be to give them an internal copy of the current track information which lasts unaltered by playback until a track switch or unload.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29348 a1c6a512-1295-4272-9138-f99709370657
2011-02-20 15:27:10 +00:00
Andree Buschmann
8033cb6250 Use MEM_ALIGN_ATTR in libfaad. Remove global array and re-use existing one.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29211 a1c6a512-1295-4272-9138-f99709370657
2011-02-05 19:50:16 +00:00
Andree Buschmann
35bcdef144 Find a more consistent and resilient way to handle SBR upsampled files. The detection is only done in one place (the metadata parser) and takes into account that the m4a header might already report corrected frame/sample sizes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29188 a1c6a512-1295-4272-9138-f99709370657
2011-02-02 15:12:55 +00:00
Andree Buschmann
4343399473 Recognize AAC-HE SBR with upsampling and correct duration, bitrate, seek and resume behaviour for such files. When SBR upsampling is used the decoder outputs the double amount of samples per frame. As the seek and resume functions do not know about this fact a special handling is introduced. Fixes issues reported in FS#11916.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29186 a1c6a512-1295-4272-9138-f99709370657
2011-02-02 09:38:24 +00:00
Nils Wallménius
74cc5c77e3 aac: put two local structs on the stack as they are small and the codec uses little stack anyway ( < 20% on h300)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28872 a1c6a512-1295-4272-9138-f99709370657
2010-12-21 13:35:02 +00:00
Andree Buschmann
5be1c33521 Fix red.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27940 a1c6a512-1295-4272-9138-f99709370657
2010-08-29 16:46:03 +00:00
Andree Buschmann
d4567b64ba Clean up alac/acc demux structure on next track. Solves issues with some files only being playable on direct selection, but not if switched to via playback engine or skip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27939 a1c6a512-1295-4272-9138-f99709370657
2010-08-29 16:43:11 +00:00
Nils Wallménius
6325ef978b codecs: mark some local variables with 'static'
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27566 a1c6a512-1295-4272-9138-f99709370657
2010-07-25 22:24:53 +00:00
Andree Buschmann
1e5327eee0 Fix red.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27232 a1c6a512-1295-4272-9138-f99709370657
2010-07-02 04:40:24 +00:00
Andree Buschmann
bcbe317565 r27225 broke AAC HE profile decoding due to missing check for buffersize. Introduce a check of needed buffersize and decide whether to use a static buffer from IRAM or faad's internal allocation routines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27231 a1c6a512-1295-4272-9138-f99709370657
2010-07-02 04:35:37 +00:00
Andree Buschmann
52f17dfe9d Submit FS#11445. Speed up of faad (aac) decoder via several optimizations like refactoring some requantization routines, moving several arrays and code tables to IRAM, using an optimized swap32() function and inlining several huffman decoder functions. Decoding is sped up by ~10% (PP5002, PP5022, MCF5249) and ~22% (MCF5250).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27225 a1c6a512-1295-4272-9138-f99709370657
2010-07-01 21:18:42 +00:00
Jeffrey Goode
6083f3dff5 Fix logf lines in codecs (type mismatches)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26038 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 01:57:32 +00:00
Andree Buschmann
cfe51fb0e8 Fix FS#11127. r25165 introduced a bug to the aac codec, which lead to not resetting the time position.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25249 a1c6a512-1295-4272-9138-f99709370657
2010-03-19 15:27:10 +00:00
Magnus Holmgren
a0692a40b2 Make resume handling in the AAC codec less confusing. No functional change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25165 a1c6a512-1295-4272-9138-f99709370657
2010-03-14 13:37:41 +00:00
Michael Giacomelli
d6ae8edc13 Commit both patches in FS#10833 - Protect against division by zero in AAC (mp4) codec by Juliusz Chroboczek. Adds some return value checking so that faad errors don't crash rockbox when decoding broken or unsupported files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23983 a1c6a512-1295-4272-9138-f99709370657
2009-12-14 01:09:01 +00:00
Björn Stenberg
6427d127aa Calculate watermark from bitrate and harddisk spinup time.
Use a smaller PCM buffer on targets with 2MB or less ram.
(FS#9703)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19743 a1c6a512-1295-4272-9138-f99709370657
2009-01-10 21:10:56 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Brandon Low
3379440a4b Remove conf_filechunk, it should never have been a setting and its implementation doesn't do what it claims any way
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15478 a1c6a512-1295-4272-9138-f99709370657
2007-11-05 17:48:21 +00:00
Magnus Holmgren
c3206a455a AAC: Add support for iTunes-style gapless playback.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13636 a1c6a512-1295-4272-9138-f99709370657
2007-06-16 13:00:52 +00:00
Michael Sevakis
3354531614 More logf fixes. speex.c wants to format 64bit args so I didn't change that one nor add any formatting for that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12858 a1c6a512-1295-4272-9138-f99709370657
2007-03-20 13:53:23 +00:00
Michael Sevakis
97f369a587 SWCODEC: Annoying neatness update. Use intptr_t for codec_configure_callback and dsp_configure and stop all the silly type casting of intergral types to pointers to set dsp configuration and watermarks. Shouldn't have any effect on already compiled codecs at all. Will fix any important patches in the tracker so they compile.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12259 a1c6a512-1295-4272-9138-f99709370657
2007-02-10 16:34:16 +00:00
Michael Sevakis
aba6ca0881 Fix resampling clicking as much as possible at the moment. 1) Upsampling clicked because of size inaccuracies returned by DSP. Fix by simplifying audio system to use per-channel sample count from codec to pcm buffer. 2) Downsampling affected by 1) and was often starting passed the end of the data when not enough was available to generate an output sample. Fix by clamping input range to last sample in buffer and using the last sample value in the buffer. A perfect fix will require a double buffering scheme on the resampler to sufficient data during small data transients on both ends at all times of the down ratio on input and the up ratio on output.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12218 a1c6a512-1295-4272-9138-f99709370657
2007-02-07 00:51:50 +00:00
Magnus Holmgren
fc1efc7b13 Fix a couple of MP4 demuxing problems, preventing playback in a few cases. All my test files now play properly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12161 a1c6a512-1295-4272-9138-f99709370657
2007-01-30 21:42:36 +00:00
Tomasz Malesinski
80da8b141c FS#6357, patch 1: let iramcopy and bss share the same space in codecs and
plugins. Currently, in case of plugins using IRAM bss is cleared twice,
once in the loader, once in PLUGIN_IRAM_INIT. For codecs, bss is cleared only
during codec initialization. Also, removed double variables in codecs
storing a pointer to codec_api.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11606 a1c6a512-1295-4272-9138-f99709370657
2006-11-26 18:31:41 +00:00
Michael Sevakis
bbef13eddf SWCODEC: Stop clicks between tracks when resampler is active by only switching the DSP frequency and not resetting the resampler at track boundaries. Will make sure DSP is correctly flushed at dicontinuities but don't hear any problems currently.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11600 a1c6a512-1295-4272-9138-f99709370657
2006-11-26 12:02:47 +00:00
Magnus Holmgren
af05296a82 Enable ReplayGain processing for AAC and ALAC (not really tested though). Also, use the 'standard' wait-for-metadata loop in the ALAC decoder.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11580 a1c6a512-1295-4272-9138-f99709370657
2006-11-23 20:05:14 +00:00
Thom Johansen
354770088e Re-enable the currently unused and broken dithering and noise shaping code already in Rockbox, and make it a user option instead of a codec-controlled option. The majority of people probably will not even hear any difference with this enabled, but feedback is welcome. Save your settings!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11368 a1c6a512-1295-4272-9138-f99709370657
2006-10-27 20:41:33 +00:00
Magnus Holmgren
9896fd1ade AAC codec: Improved MP4 file parsing. Should now handle most streamable files. Also some code cleanup and policing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11187 a1c6a512-1295-4272-9138-f99709370657
2006-10-11 17:02:23 +00:00
Magnus Holmgren
9f09a39436 Add resume support to AAC files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10720 a1c6a512-1295-4272-9138-f99709370657
2006-08-23 13:10:48 +00:00
Brandon Low
f3bc1efc49 First commit of reworking voice to be mroe stable on swcodec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9758 a1c6a512-1295-4272-9138-f99709370657
2006-04-22 14:40:13 +00:00
Brandon Low
ebadcc633a Put new_track on the codec_api, and use it instead of the reload_codec variable in most places. Should help with problems people have had with GUI vs. playback sync.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9670 a1c6a512-1295-4272-9138-f99709370657
2006-04-15 02:03:11 +00:00
Brandon Low
c76904be53 Fix warnings
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9230 a1c6a512-1295-4272-9138-f99709370657
2006-03-24 14:02:27 +00:00
Jens Arnold
8ac3ae73c5 More 64bit simulator fixes, coinciding with the long policy this time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8890 a1c6a512-1295-4272-9138-f99709370657
2006-03-03 02:09:58 +00:00
Brandon Low
1060e447f8 Part of the profiling patch to use a consistent return path in all codecs to facilitate 'on exit' functionality
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8374 a1c6a512-1295-4272-9138-f99709370657
2006-01-18 20:22:03 +00:00
Jens Arnold
b8749fdf21 New codec loader, using the same mechanism as the new plugin loader. API version numbering restarted for the new system. Uses the target ID from configure, so don't change that too often. * Fixed sim_plugin_load_ram() to truncate the tempfile. * Reduced plugin buffer size to 512KB for iriver and iPod.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8362 a1c6a512-1295-4272-9138-f99709370657
2006-01-18 00:05:14 +00:00
Daniel Stenberg
76667e2a5b fix gcc4 (un)signed warnings
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8124 a1c6a512-1295-4272-9138-f99709370657
2005-12-02 08:42:48 +00:00
Miika Pekkarinen
9c0f1a9e39 More stable playback with reduced stuttering when skipping tracks.
Removed CODEC_SET_FILEBUF_LIMIT setting; now playback.c determines how
to buffer the files.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7970 a1c6a512-1295-4272-9138-f99709370657
2005-11-18 20:21:13 +00:00
Thom Johansen
c8193b8da5 The seek_time member of the codec API needs to be decremented before use as a seeking time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7768 a1c6a512-1295-4272-9138-f99709370657
2005-11-06 19:18:04 +00:00
Thom Johansen
0263ece7f8 Use direct non-interleaved full precision output data instead of converting to 16 bit interleaved data.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7734 a1c6a512-1295-4272-9138-f99709370657
2005-11-02 19:43:52 +00:00
Dave Chapman
5006d15d1e Call ci->seek_complete() callback after processing a seek request (an old API change that wasn't implemented in all the codecs)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7717 a1c6a512-1295-4272-9138-f99709370657
2005-11-02 00:09:42 +00:00