diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-19 05:55:54 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-19 05:55:54 +0000 |
| commit | 2358fabb709bcadd300c46e11e74d48f2b115d8e (patch) | |
| tree | 343ac99ac5ffe713319a878ce6fb624973efc7c7 /apps/codecs/libm4a/m4a.c | |
| parent | 8d1d2f8982a8c68a7572a82ebc8409e257e77994 (diff) | |
| download | rockbox-2358fabb709bcadd300c46e11e74d48f2b115d8e.zip rockbox-2358fabb709bcadd300c46e11e74d48f2b115d8e.tar.gz rockbox-2358fabb709bcadd300c46e11e74d48f2b115d8e.tar.bz2 rockbox-2358fabb709bcadd300c46e11e74d48f2b115d8e.tar.xz | |
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
Diffstat (limited to 'apps/codecs/libm4a/m4a.c')
| -rw-r--r-- | apps/codecs/libm4a/m4a.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/codecs/libm4a/m4a.c b/apps/codecs/libm4a/m4a.c index 836cdaf..84144ea 100644 --- a/apps/codecs/libm4a/m4a.c +++ b/apps/codecs/libm4a/m4a.c @@ -124,10 +124,14 @@ void stream_create(stream_t *stream,struct codec_api* ci) /* Check if there is a dedicated byte position contained for the given frame. * Return this byte position in case of success or return -1. This allows to - * skip empty samples. */ -int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame) + * skip empty samples. + * During standard playback the search result (index i) will always increase. + * Therefor we save this index and let the caller set this value again as start + * index when calling m4a_check_sample_offset() for the next frame. This + * reduces the overall loop count significantly. */ +int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start) { - uint32_t i = 0; + uint32_t i = *start; for (i=0; i<demux_res->num_lookup_table; ++i) { if (demux_res->lookup_table[i].sample > frame || @@ -136,6 +140,7 @@ int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame) if (demux_res->lookup_table[i].sample == frame) break; } + *start = i; return demux_res->lookup_table[i].offset; } |