[speex-dev] some optimizations...

Alfrédo Moreira alfredo.moreira at neolinks.com
Wed Jun 2 10:58:00 PDT 2004



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
}
-----------------------------------------------------------------------------
instead of :
-----------------------------------------------------------------------------
void speex_bits_advance(SpeexBits *bits, int n)
{
   int nbytes, nbits;

   if ((bits->bytePtr<<3)+bits->bitPtr+n>bits->nbBits)
      bits->overflow=1;
   if (bits->overflow)
      return;

   nbytes = n >> 3;
   nbits = n & 7;
   
   bits->bytePtr += nbytes;
   bits->bitPtr += nbits;
   
   if (bits->bitPtr>7)
   {
      bits->bitPtr-=8;
      bits->bytePtr++;
   } // if (bits->bitPtr>7)
}
---------------------------------------------------------------------------

i'm doing other optimizations...i'll post them later...

<p>frédo

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Speex-dev mailing list