[Speex-dev] New function for manipulating SpeexBits
    Miles, Stewart 
    smiles at z-axis.com
       
    Fri Dec  8 10:48:19 PST 2006
    
    
  
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 on a certain high profile embedded game's
console at the moment and one of the performance problems is due to all
of the copying speex performs without calling memcpy.  Although memcpy()
is generally a pretty nasty function when copying very small blocks of
data (< 128 bits) from a performance point of view it does have
significant advantages when copying longer runs as some architectures
are optimized for 128bit memory access others 64bit access etc, 8 bit
stores can actually result in code that's up to 16 times slower (in the
case of the 128bit architecture).
Thanks, keep up the good work
Stewart Miles
http://www.mobygames.com/developer/sheet/view/developerId,62864/
    
    
More information about the Speex-dev
mailing list