Esempio n. 1
0
 public Int16Array copy(ShortBuffer buffer) {
   if (GWT.isProdMode()) {
     return ((Int16Array) ((HasArrayBufferView) buffer).getTypedArray())
         .subarray(buffer.position(), buffer.remaining());
   } else {
     ensureCapacity(buffer);
     for (int i = buffer.position(), j = 0; i < buffer.limit(); i++, j++) {
       shortBuffer.set(j, buffer.get(i));
     }
     return shortBuffer.subarray(0, buffer.remaining());
   }
 }
Esempio n. 2
0
  /**
   * Write a liftblock
   *
   * @param coeff an array
   * @param bmin start position
   * @param bmax end position
   */
  void write_liftblock(Int16Array coeff, int bmin, int bmax) {
    int n = bmin << 4;

    coeff.set(zeros);

    for (int n1 = bmin; n1 < bmax; n1++) {
      Block d = getBlock(n1);

      if (d == null) {
        n += 16;
      } else {
        for (int n2 = 0; n2 < 16; ) {
          coeff.set(zigzagloc[n], d.get(n2));
          n2++;
          n++;
        }
      }
    }
  }
Esempio n. 3
0
 private void ensureCapacity(ShortBuffer buffer) {
   if (buffer.remaining() > shortBuffer.length()) {
     shortBuffer = TypedArrays.createInt16Array(buffer.remaining());
   }
 }