Displaying 20 results from an estimated 23 matches for "nbbit".
Did you mean:
nbit
2004 Aug 06
1
speex_bits_pack optimizations...
another optimization you can do for packing bits together...
the original one is :
-------------------------------------------------------------------------------------------------------------
void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
{
int i;
unsigned int d=data;
if (bits->bytePtr+((nbBits+bits->bitPtr)>>3) >= bits->buf_size)
{
//remain unchanged....
}
while(nbBits)
{
int bit;
bit = (d>>(nbBits-1))&1;
bits->bytes[bits->bytePtr] |= bit<<(7-...
2009 Oct 29
1
speex_bits_write_whole_bytes problem
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20091029/e587399d/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmezo.vcf
Type: text/x-vcard
Size: 345 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20091029/e587399d/attachment.vcf
2006 Dec 09
1
A question about speex_bits_write function
...sage 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 > ((bit...
2006 Aug 01
2
bits.c problem
...a some kind
tutorial and patches), but it seems to be a little bug in bits.c. The code
looks like this
void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
{
////////////////// bla-bla-bla ///////////////////
for (i=0;i<len;i++)
bits->chars[i]=chars[i];
bits->nbBits=len<<3; //!!!!!!!!!!!!!!!!!!!
bits->charPtr=0;
bits->bitPtr=0;
bits->overflow=0;
}
What is bits->nbBits=len<<3 ? Shouldn't it be bits->nbBits=len<<3
LOG2_BITS_PER_CHAR ?
And another question. What is the difference between functions
speex...
2004 Aug 06
2
bug found in speex_bits_read_whole_bytes
...me. For this
reason, I call speex_bits_read_whole_bytes() and fill
it to MAXIMUM in a loop while calling speex_decode()
until there are no more bytes to read.
SYMPTOM:
You can only go up to MAX_BYTES_PER_FRAME-1 due an
incorrect calculation in the function.
LINES THAT ARE THE PROBLEM:
((bits->nbBits>>3)+len+1
should read
((bits->nbBits+7)>>3)+len
otherwise if nbBits is 0 or a full byte, the buffer
will never get to MAX_BYTES_PER_FRAME.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com...
2004 Aug 06
0
some optimizations...
i'm optimizing some features....for exemple why not doing this :
-------------------------------------------------------------------------------
void speex_bits_advance(SpeexBits *bits, int n)
{
if (((bits->bytePtr<<3)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
bits->overflow=1;
return;
}
bits->bytePtr += (bits->bitPtr+nbBits) >> 3; //divide by 8
bits->bitPtr = (bits->bitPtr+nbBits) & 7; // modulo by 8
}
-----------------------------------------------------------------------------...
2008 Mar 29
0
GCC/ELF Visibility patch
...@@ -153,7 +153,7 @@
bits->charPtr=0;
}
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
+EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
{
int i,pos;
int nchars = nbytes/BYTES_PER_CHAR;
@@ -185,7 +185,7 @@
bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
}
-int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
{
int i;
int max_nchars = max_nbytes/BYTES_PER_CHAR;
@@ -208,7 +208,7 @@
return max_nchars*BYTES_PER_C...
2008 Mar 29
2
GCC/ELF Visibility patch (fwd)
...@@ -153,7 +153,7 @@
bits->charPtr=0;
}
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
+EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
{
int i,pos;
int nchars = nbytes/BYTES_PER_CHAR;
@@ -185,7 +185,7 @@
bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
}
-int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
{
int i;
int max_nchars = max_nbytes/BYTES_PER_CHAR;
@@ -208,7 +208,7 @@
return max_nchars*BYTES_PER_C...
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
2004 Aug 06
0
bug found in speex_bits_read_whole_bytes
...hole_bytes() and fill
> it to MAXIMUM in a loop while calling speex_decode()
> until there are no more bytes to read.
>
> SYMPTOM:
> You can only go up to MAX_BYTES_PER_FRAME-1 due an
> incorrect calculation in the function.
>
> LINES THAT ARE THE PROBLEM:
> ((bits->nbBits>>3)+len+1
> should read
> ((bits->nbBits+7)>>3)+len
> otherwise if nbBits is 0 or a full byte, the buffer
> will never get to MAX_BYTES_PER_FRAME.
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site desig...
2006 Dec 11
0
A question about speex_bits_write function
...eex_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;
&...
2006 Sep 19
0
Multiple frame encode and decode
...tiple frame inside e.g 6
speex frames. I packed those frames manually by
concating them into a buffer(memcpy at certain array
index).
Then at the other side, i decode them in a while loop
using speex_decode_int(), and hoping that this
function will decode one frame at a time.
But when i inspected nbBits, it seemed all of 6 frames
decoded at once. I guess the decoder didn`t find the
terminator bits. And no sound at all.
Did I do anything wrong?
Speex setting: narrow band, 8000 khz,20ms,8000 bps.
1 frame encoded size = 20 bytes
1 frame decoded size = 160 bytes, but i got 960
bytes(160 x 6 frames)...
2006 Dec 09
1
New function for manipulating SpeexBits
It would be nice to have the following function added to the speex
bits...
void speex_bits_read_from_buffer(
SpeexBits * const bits,
void * const buff,
const int buf_size)
{
bits->bytes = (char*)buff;
bits->buf_size = buf_size;
bits->nbBits = buf_size << 3;
bits->bytePtr = 0;
bits->bitPtr = 0;
bits->owner = 0;
bits->overflow = 0;
}
... so a bitstream can be assigned to a SpeexBits structure for
processing by a decoder rather than unnecessarily copying the data.
As an aside, I'm working...
2006 Dec 29
0
using speex in C#
...void *speex_encoder_init_new(int modeID)
{
const SpeexMode *mode;
mode = speex_lib_get_mode(modeID);
return mode->enc_init(mode);
}
Maybe following codes that I have been using in a class can help you.
/* structs */
public struct SpeexBits
{
char *chars; /* "raw" data */
int nbBits; /* Total number of bits stored in the
stream*/
int charPtr; /* Position of the byte "cursor" */
int bitPtr; /* Position of the bit "cursor" within the
current char */
int owner; /* Does the struct "own" the "raw" buffer
(member "chars"...
2004 Aug 06
2
SPEEX_SET_USER_HANDLER once again
...eex_bits_init_buffer_ex(SpeexBits *bits, void *buff, int
buf_size){
if (buff == NULL || buf_size == 0)
return -1;
memset(bits, 0, sizeof(SpeexBits));
bits->bytes = (char*)buff;
bits->buf_size = buf_size;
bits->nbBits=buf_size << 3;
return 0;
}
int CSpeexDecoderThread::DecodePlay(void* state, SpeexStereoState
stereo,
char* pcData, DWORD dwLength, int nchannels, int frame_size, int
ynccount){
...
if (synccount > 0){
callback.callback_id = 0;...
2006 Dec 11
0
New function for manipulating SpeexBits
...g function added to the speex
> bits...
>
> void speex_bits_read_from_buffer(
> SpeexBits * const bits,
> void * const buff,
> const int buf_size)
> {
> bits->bytes = (char*)buff;
> bits->buf_size = buf_size;
> bits->nbBits = buf_size << 3;
> bits->bytePtr = 0;
> bits->bitPtr = 0;
> bits->owner = 0;
> bits->overflow = 0;
> }
>
> ... so a bitstream can be assigned to a SpeexBits structure for
> processing by a decoder rather than unnecessarily copying...
2006 Dec 28
0
using speex in C#
Hi,
I have read the message below,
http://lists.xiph.org/pipermail/speex-dev/2006-October/004924.html
and try to use P/Invoke to use speex in C#.
This is a part of my code.
[StructLayout(LayoutKind.Sequential)]
public struct SpeexBits {
IntPtr chars; // "raw" data
int nbBits; // Total number of bits stored in the stream
int charPtr; // Position of the byte "cursor"
int bitPtr; // Position of the bit "cursor" within the current char
int owner; // Does the struct "own" the "raw" buffer (member "chars")
in...
2007 Apr 25
0
echo cancellation on Blackfin DSK
...tream
for(i = 0; i < SPEEX_FRAME_SIZE; i++)
{
*in_left++ = *in++; // channel 1
in++; // channel 2
}
in_left = in_buffer_calc;
speex_bits_reset(&g_Bits);
// Encode the frame
speex_encode_int(g_pvEnc, (spx_int16_t *)in_left, &g_Bits);
nbBits = speex_bits_write(&g_Bits, cbits, 200);
speex_bits_rewind(&g_Bits);
SpeexEchoState *st=
speex_echo_state_init(SPEEX_FRAME_SIZE,filter_length);
speex_echo_cancel(st,(spx_int16_t *)in_left,(spx_int16_t
*)out_left,(spx_int16_t *)out2,NULL);
speex_echo_state_destroy(st);...
2004 Aug 06
0
SPEEX_SET_USER_HANDLER once again
...int
> buf_size){
>
> if (buff == NULL || buf_size == 0)
> return -1;
>
> memset(bits, 0, sizeof(SpeexBits));
>
> bits->bytes = (char*)buff;
> bits->buf_size = buf_size;
> bits->nbBits=buf_size << 3;
>
> return 0;
> }
>
> int CSpeexDecoderThread::DecodePlay(void* state, SpeexStereoState
> stereo,
> char* pcData, DWORD dwLength, int nchannels, int frame_size,
> int
> synccount){
>
> ...
>
> if...
2007 Feb 09
1
speex in C# please help
...lic const int Max_Frame_Size = 2000;
public const int Speex_Get_Frame_Size = 3;
public const int Speex_Set_Quality = 4;
public const int Speex_nb_Mode = 3;
//create the structure that will hold the speexbits
public struct SpeexBits
{
public char *chars; /* "raw" data */
public int nbBits; /* Total number of bits stored in thestream*/
public int charPtr; /* Position of the byte "cursor" */
public int bitPtr; /* Position of the bit "cursor" within thecurrent char */
public int owner; /* Does the struct "own" the "raw" buffer(member "ch...