diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-09-02 08:51:04 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-09-02 08:51:04 +0000 |
commit | 3fa17e67a45c2362e741dfa0047388035e1f589f (patch) | |
tree | 3e4f97795d8b95ad869af013d1d2c8d6ea6057fe /ext/speex/gstspeexenc.c | |
parent | 1ebf38c9592572c2cea05cc0a06644f558c0139b (diff) |
ext/speex/: Use integer encoding and decoding functions instead of converting the integer input to float in the eleme...
Original commit message from CVS:
* ext/speex/gstspeexdec.c: (speex_dec_chain_parse_data):
* ext/speex/gstspeexdec.h:
* ext/speex/gstspeexenc.c: (gst_speex_enc_encode):
* ext/speex/gstspeexenc.h:
Use integer encoding and decoding functions instead of converting
the integer input to float in the element. The libspeex integer
functions are doing this for us already or, if libspeex was compiled
in integer mode, they're doing everything using integer arithmetics.
Also saves some copying around.
Diffstat (limited to 'ext/speex/gstspeexenc.c')
-rw-r--r-- | ext/speex/gstspeexenc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c index a7059edf..963d5607 100644 --- a/ext/speex/gstspeexenc.c +++ b/ext/speex/gstspeexenc.c @@ -867,25 +867,21 @@ gst_speex_enc_encode (GstSpeexEnc * enc, gboolean flush) while (gst_adapter_available (enc->adapter) >= bytes) { gint16 *data; - gint i; gint outsize, written; GstBuffer *outbuf; - data = (gint16 *) gst_adapter_peek (enc->adapter, bytes); - - for (i = 0; i < frame_size * enc->channels; i++) { - enc->input[i] = (gfloat) data[i]; - } - gst_adapter_flush (enc->adapter, bytes); + data = (gint16 *) gst_adapter_take (enc->adapter, bytes); enc->samples_in += frame_size; GST_DEBUG_OBJECT (enc, "encoding %d samples (%d bytes)", frame_size, bytes); if (enc->channels == 2) { - speex_encode_stereo (enc->input, frame_size, &enc->bits); + speex_encode_stereo_int (data, frame_size, &enc->bits); } - speex_encode (enc->state, enc->input, &enc->bits); + speex_encode_int (enc->state, data, &enc->bits); + + g_free (data); enc->frameno++; enc->frameno_out++; |