diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-05-29 19:00:05 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-05-29 19:00:05 +0200 |
commit | dcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9 (patch) | |
tree | 714708e14bc8b4ac0f0d12748bf4620339e7e6bd | |
parent | 046a8f021304f131a46e290cab40ee8c8db9c6ea (diff) | |
download | xine-lib-dcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9.tar.gz xine-lib-dcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9.tar.bz2 |
Use the integer versions of Speex decoding functions, this avoids an iteration over the decoded frames to transform them to integer, and also avoids an improper saturation.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/libxineadec/xine_speex_decoder.c | 21 |
2 files changed, 5 insertions, 19 deletions
@@ -15,6 +15,9 @@ xine-lib (1.1.7) (unreleased) * Document dvba: MRLs (ATSC with full tuning info). * Fix VCD playback (broken since 1.1.4). * Fix demuxing of FLAC files with ID3v2 tags. + * Use the integer versions of Speex decoding functions, this avoids an + iteration over the decoded frames to transform them to integers, and + also avoids an improper saturation. xine-lib (1.1.6) * Split the DirectFB plugin into X11 and non-X versions. diff --git a/src/libxineadec/xine_speex_decoder.c b/src/libxineadec/xine_speex_decoder.c index b729dc3bb..034e726a6 100644 --- a/src/libxineadec/xine_speex_decoder.c +++ b/src/libxineadec/xine_speex_decoder.c @@ -72,8 +72,6 @@ typedef struct speex_decoder_s { SpeexStereoState stereo; int expect_metadata; - float output[MAX_FRAME_SIZE]; - int header_count; xine_stream_t *stream; @@ -296,9 +294,8 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { for (j = 0; j < this->nframes; j++) { int ret; int bitrate; - ogg_int16_t * ptr = audio_buffer->mem; - ret = speex_decode (this->st, &this->bits, this->output); + ret = speex_decode_int (this->st, &this->bits, audio_buffer->mem); if (ret==-1) break; @@ -312,27 +309,13 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } if (this->channels == 2) { - speex_decode_stereo (this->output, this->frame_size, &this->stereo); + speex_decode_stereo_int (audio_buffer->mem, this->frame_size, &this->stereo); } speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate); if (bitrate <= 1) bitrate = 16000; /* assume 16 kbit */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, bitrate); - /*PCM saturation (just in case)*/ - for (i=0; i < this->frame_size * this->channels; i++) - { - if (this->output[i]>32000.0) - this->output[i]=32000.0; - else if (this->output[i]<-32000.0) - this->output[i]=-32000.0; - } - - /*Convert to short and play */ - for (i=0; i< this->frame_size * this->channels; i++) { - *ptr++ = (ogg_int16_t)this->output[i]; - } - audio_buffer->vpts = this->pts; this->pts=0; audio_buffer->num_frames = this->frame_size; |