yaseminyilmaz
2006-Dec-11 01:24 UTC
[Speex-dev] A question about speex_bits_write function
Thanks a lot for your explanations. Is it right I understand? if I've set SPEEX_SET_BITRATE to 16000(bps) this means that output is 16000/8=2000 bytes and I should set MAX_FRAME_BYTES and the length of cbits to 2000. Is it right? Maybe it is simple question but your answer is important for me, actually thanks a lot for your helps. Yasemin The last argument should simply be the size of your own buffer, i.e. it's there to make sure there's no buffer overflow and that's it. If you know that at the bit rate you're using the output is 20 bytes, then you can choose to allocate a 20-byte buffer and let speex_bits_write() know that. Same idea as e.g. strncpy(), which is safer than strcpy(). Jean-Marc yaseminyilmaz wrote:> Hi everybody, > > I need clarification about speex_bits_write function usage. There is an > example usage of it. > > nbBytes = speex_bits_write(&bits, cbits, MAX_FRAME_BYTES); > > I examine the content of this function and which value should I set to > MAX_FRAME_BYTE. In speexenc project, it is 2000 and in manual it is 200. > For example, I set it to 200 but the length of bits->chars is 250 > (bits->nbBits is 2000), is this right? If so, max_nchars gets 200 value > because following statement in speex_bits_write and the condition of if > statement does not achieve. (in my environment, BYTES_PER_CHAR=1, > speex_nb_mode, 8 kHz, 15 kbps) > > int max_nchars = max_nbytes/BYTES_PER_CHAR; > > if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)) > > max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR); > > > > Excuse me if I make longer my question. Which value should I set to > MAX_FRAME_BYTES and why? > > Can you please help me? > > Thanks in advance > > Sincerely > > Yasemin > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev------------------------------ Message: 4 Date: Sun, 10 Dec 2006 15:40:11 +0100 From: "Daniel Schmidt" <dschmidt2006@googlemail.com> Subject: Re: [Speex-dev] Patch for sb_celp.c and a few questions To: speex-dev@xiph.org Message-ID: <a525d69f0612100640v64ec89b6v9f9a634ff5e9ae28@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hello Jean-Marc, thank you for your reply. I have another question regarding the current AGC algorithm. When it runs several minutes, it doesn't seem to increase the gain anymore but still reduces it immediately (and therefore permanently) after a loud noise, e.g. when the user touches the headset's microphone. Is this behaviour intentional? Regards Daniel ------------------------------ _______________________________________________ Speex-dev mailing list Speex-dev@xiph.org http://lists.xiph.org/mailman/listinfo/speex-dev End of Speex-dev Digest, Vol 31, Issue 11 *****************************************