search for: speex_bits_insert_terminator

Displaying 20 results from an estimated 40 matches for "speex_bits_insert_terminator".

2006 Dec 09
1
one more question about speex_bits_insert_terminator and speex_bits_write
Hi everybody, I have been examining on how I can use speex completely so I have one more question. I looked at examples and source code and it goes on. speex_bits_insert_terminator is called in speex_bits_write function. Shall I call this method one more time anywhere? Because in speexenc project, firstly speex_bits_insert_terminator is called then speex_bits_write is called when we assume that nframe=1. But according to manuel, only speex_bits_write function is called. What...
2004 Aug 06
3
Multiple Frames per Packet
David, Here's the trick ... do this just before your speex_bits_write(): speex_bits_insert_terminator(&bits); Then, when decoding, keep calling speex_decode() until it returns -1 or speex_bits_remaining(&bits) returns 0. Works for me, anyway. Tom David Barrett (dbarrett@quinthar.com) wrote: > > Hi, I'm using Speex and I want to pack multiple frames into a single > packet....
2011 Jul 26
3
More frames in one packet
After searching the mailing list archive (I forgot to do that before posting, sorry!) I found the solutions: 1) The documentation has a mistake: The bit terminator is NOT set automatically! (I'm using the latest speex version!) It has to be set manually using speex_bits_insert_terminator(&bits); 2) speex_decoder_int() has to be called as long, as it returns -1. After that, all frames should be decoded. This should be added to the docu! Bugreport: I tried using speex_bits_remaining() instead of checking the return value of speex_decoder_int() but this leads to an endless loop!...
2010 Apr 11
2
Is Speex 1.0 and >=1.1 compatible?
...; if (buf_len == frame_size) > > { > > > > speex_encode(enc_state, sample_buf,&bits); > > buf_len = 0; > > > > if (++frame_cnt == 4) // Four frames per packet > > { > > > > speex_bits_insert_terminator(&bits); > > int nbytes = speex_bits_nbytes(&bits); > > char output_buf[nbytes]; > > nbytes = speex_bits_write(&bits, output_buf, nbytes); > > writeEncodedSamples(output_buf, nbytes); > > speex_bits_reset(&bit...
2007 Aug 06
2
Attempting to shrink speex: Are these functions necessary?
...In bits.c: speex_bits_init speex_bits_init_buffer speex_bits_destroy speex_bits_reset speex_bits_rewind speex_bits_read_from speex_bits_flush speex_bits_read_whole_bytes speex_bits_write speex_bits_write_whole_bytes speex_bits_unpack_signed speex_bits_peek_unsigned speex_bits_peek speex_bits_nbytes speex_bits_insert_terminator In cd_search.c: noise_codebook_quant noise_codebook_unquant In filters.c: compute_rms syn_percep_zero16 qmf_decomp qmf_synth In ltp.c: forced_pitch_quant forced_pitch_unquant In math_approx.c: spx_ilog2 _spx_cos_pi_2 spx_cos_norm spx_exp2 spx_atan In nb_celp.c: nb_encoder_destroy nb_decod...
2004 Aug 06
0
Multiple Frames per Packet
...a relatively new thing. I'm not even sure if it's necessary, but I think Jean-Marc recommended using it back when I asked this question awhile ago..? Anyway, glad it's working for you. Tom David Barrett (dbarrett@quinthar.com) wrote: > > Aha. Thanks. I don't seem to have speex_bits_insert_terminator(&bits); > in my installed version (1.0.4), but I was able to use > speex_bits_remaining(&bits). However, speex_bits_remaining(&bits) > doesn't return 0 -- it returns -1 when it's empty. > > Odd, eh? But it works. Thanks! > > -david > > On Thu, 29 Ju...
2006 Aug 06
2
Speex + Ogg package
...encoder I have this code: speex_bits_reset(&enc_bits); for(int i=0;i<FRAMES_PACKET;i++) { int nb_samples; //Here I get the microphone data. while((nb_samples=Check_Mic(Mic_data))==0); speex_encode_int(enc_state, Mic_data, &enc_bits); total_samples += nb_samples; speex_bits_insert_terminator(&enc_bits); //The time stamp if(i==0) ((int*)packet)[0]=total_samples; } int nbBytes = speex_bits_write(&enc_bits, packet+4, 2000); tam=nbBytes+4; //Now the ogg package op.packet = (unsigned char *)packet; op.bytes = nbBytes+4; op.b_o_s = 0; op.packetno = packet_id; packet...
2010 Apr 10
2
Is Speex 1.0 and >=1.1 compatible?
...t *samples, int count) { for (int i=0; i<count; ++i) { sample_buf[buf_len++] = samples[i] * 32767.0; if (buf_len == frame_size) { speex_encode(enc_state, sample_buf, &bits); buf_len = 0; if (++frame_cnt == 4) // Four frames per packet { speex_bits_insert_terminator(&bits); int nbytes = speex_bits_nbytes(&bits); char output_buf[nbytes]; nbytes = speex_bits_write(&bits, output_buf, nbytes); writeEncodedSamples(output_buf, nbytes); speex_bits_reset(&bits); frame_cnt = 0; } } } return...
2005 Jun 22
1
Newbie - Encoding PCM
...for(c=0;c<num_samples;c++) { /* tempbuf 0<-127->256 */ /* pcmbuff -32786 <- 0 -> +32786 */ PCM_F[d] = (PCM[c] << 8)^0x8000; d++; if(d > 160) { speex_bits_reset(&IDA->speex_bits); speex_encode_int(IDA->speex_state,PCM_F,&IDA->speex_bits); speex_bits_insert_terminator(&IDA->speex_bits); d = speex_bits_write(&IDA->speex_bits, buffer, 200); *buffer += d; ret += d; d = 0; } } return ret; } int SPEEX_Init(struct _IDA_ClientSocket *IDA) { /* speex_init_header(&IDA->speex_header,8000,1,IDA->speex_mode); */...
2005 Sep 03
2
Library export file for Win32 (patch)
...bits_rewind -speex_bits_read_from -speex_bits_read_whole_bytes -speex_bits_write -speex_bits_write_whole_bytes -speex_bits_pack -speex_bits_unpack_signed -speex_bits_unpack_unsigned -speex_bits_nbytes -speex_bits_peek_unsigned -speex_bits_peek -speex_bits_advance -speex_bits_remaining -speex_bits_insert_terminator -speex_inband_handler -speex_std_mode_request_handler -speex_std_high_mode_request_handler -speex_std_char_handler -speex_default_user_handler -speex_std_low_mode_request_handler -speex_std_vbr_request_handler -speex_std_enh_request_handler -speex_std_vbr_quality_request_handler -speex_in...
2008 Nov 13
2
decoded sample is completely differen from original one
...665D, 0x6376, 0x696F, 0x6830, 0x6577, 0x6D74}; state = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); speex_encoder_ctl(state, SPEEX_SET_QUALITY, &quality); speex_bits_init(&bits); speex_bits_reset(&bits); speex_encode_int(state, &input[0], &bits); speex_bits_insert_terminator(&bits); * nbBytes = speex_bits_write(&bits, encSamples, FRAME_SIZE); speex_encoder_destroy(state); speex_bits_destroy(&bits); return 0; } int decode(int nbBytes, char * encSamples) { spx_int16_t output[FRAME_SIZE]; void * state; SpeexBits bits;...
2005 Apr 04
1
tgAudioCodec.zip
...r version that has been very solid for me. I'm pretty sure the problem is on my end but I haven't figured it out yet... I thought it might be related to packing multiple frames together. Can you tell me if it's still ok to do speex_bits_init, call speex_encode several times, then speex_bits_insert_terminator, then speex_bits_write + speex_bits_destroy. And then on the decoding side do speex_bits_init, speex_bits_read_from, and loop on speex_decode until either it returns -1 or speex_bits_remaining returns <= 0? > If you still intend to work on your wrapper, it would be nice to keep it > a...
2011 Nov 17
1
Just getting noise
.../decode methods. Based off of your suggestions I tried the following but I get the same result. virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, size_t& outputSize) { speex_bits_reset(&mBits); speex_encode_int(mState, (Enigma::s16*)inputBuffer, &mBits); speex_bits_insert_terminator(&mBits); outputSize = speex_bits_nbytes(&mBits); /*Copy the bits to an array of char that can be written*/ Enigma::u8* cbits = new Enigma::u8[outputSize](); speex_bits_write(&mBits, (char*)cbits, outputSize); return cbits; } virtual Enigma::u8* Decode(Enigma::u8* i...
2006 Sep 15
2
Constant noise in the background in realtime data
...for(int i = 0; i < nBuffSize; i++) input[i] = ( (pData[(i*2) + 1] << 8) | (pData[(i*2)] & 0xff) ) / 32768.0f; // Provide speex with the float array pointer to compress speex_encode(m_poSpeexCompressState, input, &m_oBits); // Write the encoded bytes into our array speex_bits_insert_terminator(&m_oBits); nbBytes = speex_bits_write(&m_oBits, cbits, BUFFERSIZE); // Set the number of bytes of encoded message *iFrameSize = nbBytes; // Copy encoded bytes into return array memcpy(cComFrame, cbits, nbBytes); } //-------------------------------------------------...
2007 Aug 07
1
Attempting to shrink speex: Are these functions necessary?
..._destroy > speex_bits_reset > speex_bits_rewind > speex_bits_read_from > speex_bits_flush > speex_bits_read_whole_bytes > speex_bits_write > speex_bits_write_whole_bytes > speex_bits_unpack_signed > speex_bits_peek_unsigned > speex_bits_peek > speex_bits_nbytes > speex_bits_insert_terminator You probably don't need most of these, but I'm surprised you're not at least using speex_bits_init(), speex_bits_read_from() and speex_bits_write(). What are you using instead? > In cd_search.c: > noise_codebook_quant > noise_codebook_unquant No need for that (assuming you o...
2005 May 25
2
Speex on TI C6x, Problem with TI C5x Patch
...ould not resize input buffer: not packing" messages. I haven't had time >> to >> figure out what that means or what causes it, but will if I get time. > > I just fixed a but in bits.c (see Jim's previous email), maybe that was > the cause. Yes, that's right. speex_bits_insert_terminator keeps calling speex_pack_bits forever, because bitPtr never reaches 15. Eventually the bit buffer runs out of room. >> 5) Re: stack memory allocations, yes, a compile-time option would be >> great >> to reduce the stack sizes. Ideally what is needed is the minimum stack >...
2007 Aug 07
1
Attempting to shrink speex: Are these functions necessary?
..._destroy > speex_bits_reset > speex_bits_rewind > speex_bits_read_from > speex_bits_flush > speex_bits_read_whole_bytes > speex_bits_write > speex_bits_write_whole_bytes > speex_bits_unpack_signed > speex_bits_peek_unsigned > speex_bits_peek > speex_bits_nbytes > speex_bits_insert_terminator > > In cd_search.c: > noise_codebook_quant > noise_codebook_unquant > > In filters.c: > compute_rms > syn_percep_zero16 > qmf_decomp > qmf_synth > > In ltp.c: > forced_pitch_quant > forced_pitch_unquant > > In math_approx.c: > spx_ilog2 &gt...
2005 Apr 26
1
tgAudioCodec.zip
...ase it's a problem with Speex. > Perhaps just tracking down when it happened could help. > > > I thought it might be related to packing multiple frames together. Can > > you tell me if it's still ok to do speex_bits_init, call speex_encode > > several times, then speex_bits_insert_terminator, then speex_bits_write + > > speex_bits_destroy. And then on the decoding side do speex_bits_init, > > speex_bits_read_from, and loop on speex_decode until either it returns -1 > > or speex_bits_remaining returns <= 0? > > Should be OK. Now, even just speex_bits_writ...
2011 Nov 16
2
Just getting noise
Alright noted, I changed me code so that the state is created in the constructor and destroyed in the destructor of the object. However I'm still getting the same issue although I'm sure that would have bit me sooner or later. The new code is as follows. virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, size_t& outputSize) { short *in=(short*)inputBuffer;
2004 Aug 06
0
Encode-Decode Problem
I have non terminate loop when decode speex bits stream. These are my pseudocode for encoding and decoding -- Encode -- while(stillhaveinput) { speex_encode(enc_state, curr_spx_frame, &bits); } speex_bits_insert_terminator(&bits); speex_bits_write(&bits,(char *)(pBufferOut),MAX_LEN); -- Decode (these code loop forever) -- speex_bits_read_from(&bits, (char *) pBuf,act_length); result=speex_decode(dec_state, &bits, curr_spx_frm); while(result==0) { result=speex_decode(dec_state, &bits, curr_spx_f...