[speex-dev] optimization proposal for jspeex

Ulrich B. Staudinger us at die-horde.de
Mon Nov 3 02:36:30 PST 2003



hi,

here is test case one with original code (optimized code is at bottom of 
mail):

Diff: 17
32
Diff: 15
32
Diff: 14
32
Diff: 14
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 17
32
Diff: 15
32
Diff: 15
32
Diff: 14
32
Diff: 14
32
Diff: 14
32
Diff: 15
32
Diff: 15
32
Diff: 99
32
Diff: 30
32
Diff: 14
32
Diff: 15
32
Diff: 16
32
Diff: 15
32
Diff: 16
32
Diff: 65
32
Diff: 45
32
Diff: 18
32
Diff: 43
root at mainframe:/home/uls/eclipse/avrelay#

the diff clearly has spikes which go up to 60 ms ...

now optimized code:

Diff: 17
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 17
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 15
32
Diff: 16
32
32
Diff: 18
32
Diff: 15
32
Diff: 15
32
Diff: 16
32
Diff: 15
32
Diff: 15
root at mainframe:/home/uls/eclipse/avrelay#

much more stable at rates off about 16ms.

changed code in SpeexEncoder.java:

 public int getProcessedData(byte[] data, int offset)
  {
    int size = bits.getBufferSize();
   
    //System.arraycopy(bits.getBuffer(), 0, data, offset, size);   <- 
this one is slow

    //better is a manual copy

    for(int i=0;i<size;i++){
        data[i + offset]=bits.getBuffer()[i];
    }
   
    bits.init();
    return size;
  }

<p>ulrich

p.s. sorry for the last return reciepts ...

--- >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