summaryrefslogtreecommitdiff
path: root/apps/codecs/speex.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-11-01 21:34:15 +0000
committerThom Johansen <thomj@rockbox.org>2007-11-01 21:34:15 +0000
commit80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9 (patch)
tree899b90e2c80053f010f8a6e552c8943d849ced12 /apps/codecs/speex.c
parentbf1b7f131c933b83afe62f01c200366e4e2e37f3 (diff)
downloadrockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.zip
rockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.tar.gz
rockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.tar.bz2
rockbox-80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9.tar.xz
Make Speex read its input directly from the Ogg packet, which makes for less copying and one less malloc(). Thanks to Jean-Marc Valin for the tip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15395 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/speex.c')
-rw-r--r--apps/codecs/speex.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/apps/codecs/speex.c b/apps/codecs/speex.c
index d26d6f9..7edda4b 100644
--- a/apps/codecs/speex.c
+++ b/apps/codecs/speex.c
@@ -364,7 +364,6 @@ static void *process_header(spx_ogg_packet *op,
*extra_headers = header->extra_headers;
- codec_free(header);
return st;
}
@@ -413,8 +412,6 @@ next_track:
samplerate = ci->id3->frequency;
codec_set_replaygain(ci->id3);
- speex_bits_init(&bits);
-
eof = 0;
while (!eof) {
ci->yield();
@@ -513,10 +510,9 @@ next_page:
if (op.e_o_s) /* End of stream condition */
eos=1;
- /* Copy Ogg packet to Speex bitstream */
-
- speex_bits_read_from(&bits, (char*)op.packet, op.bytes);
-
+ /* Set Speex bitstream to point to Ogg packet */
+ speex_bits_set_bit_buffer(&bits, (char *)op.packet,
+ op.bytes);
for (j = 0; j != nframes; j++){
int ret;
@@ -561,7 +557,6 @@ done:
/* Clean things up for the next track */
speex_decoder_destroy(st);
- speex_bits_reset(&bits);
if (stream_init == 1)
spx_ogg_stream_reset(&os);