Example #1
0
 public void readFrom(DataInput in) throws Exception {
   status = in.readInt();
   classname = Bits.readString(in);
   name = Bits.readString(in);
   start_time = in.readLong();
   stop_time = in.readLong();
   failure_type = Bits.readString(in);
   failure_msg = Bits.readString(in);
   stack_trace = Bits.readString(in);
 }
Example #2
0
 public void writeTo(DataOutput out) throws Exception {
   out.writeInt(status);
   Bits.writeString(classname, out);
   Bits.writeString(name, out);
   out.writeLong(start_time);
   out.writeLong(stop_time);
   Bits.writeString(failure_type, out);
   Bits.writeString(failure_msg, out);
   Bits.writeString(stack_trace, out);
 }
Example #3
0
  public static void writeSingleHits(
      IntBP positions, FloatBP weights, IntBP las, String prefix, int chrom) throws IOException {
    String postmp = getPositionsFname(prefix, chrom) + ".tmp";
    String weightstmp = getWeightsFname(prefix, chrom) + ".tmp";
    String lastmp = getLaSFname(prefix, chrom) + ".tmp";
    RandomAccessFile positionsRAF = new RandomAccessFile(postmp, "rw");
    RandomAccessFile weightsRAF = new RandomAccessFile(weightstmp, "rw");
    RandomAccessFile lasRAF = new RandomAccessFile(lastmp, "rw");

    Bits.sendBytes(positions.bb, 0, positions.bb.limit(), positionsRAF.getChannel());
    Bits.sendBytes(weights.bb, 0, weights.bb.limit(), weightsRAF.getChannel());
    Bits.sendBytes(las.bb, 0, las.bb.limit(), lasRAF.getChannel());
    positionsRAF.close();
    weightsRAF.close();
    lasRAF.close();

    /* ideally this part with the renames would atomic... */
    (new File(postmp)).renameTo(new File(getPositionsFname(prefix, chrom)));
    (new File(weightstmp)).renameTo(new File(getWeightsFname(prefix, chrom)));
    (new File(lastmp)).renameTo(new File(getLaSFname(prefix, chrom)));
  }
Example #4
0
  /**
   * Process <code>SERIAL_SIZE</code> short of speech.
   *
   * @param serial input : serial array encoded in bits_ld8k
   * @param sp16 output : speech short array
   */
  void process(short[] serial, short[] sp16) {
    Bits.bits2prm_ld8k(serial, 2, parm, 1);

    /* the hardware detects frame erasures by checking if all bits
       are set to zero
    */
    parm[0] = 0; /* No frame erasure */
    for (int i = 2; i < SERIAL_SIZE; i++) if (serial[i] == 0) parm[0] = 1; /* frame erased     */

    /* check parity and put 1 in parm[4] if parity error */

    parm[4] = PParity.check_parity_pitch(parm[3], parm[4]);

    int t0_first = decLd8k.decod_ld8k(parm, voicing, synth, synth_offset, Az_dec); /* Decoder */

    /* Post-filter and decision on voicing parameter */
    voicing = 0;

    float[] ptr_Az = Az_dec; /* Decoded Az for post-filter */
    int ptr_Az_offset = 0;

    for (int i = 0; i < L_FRAME; i += L_SUBFR) {
      int sf_voic; /* voicing for subframe */

      sf_voic = postfil.post(t0_first, synth, synth_offset + i, ptr_Az, ptr_Az_offset, pst_out, i);
      if (sf_voic != 0) {
        voicing = sf_voic;
      }
      ptr_Az_offset += MP1;
    }
    Util.copy(synth_buf, L_FRAME, synth_buf, M);

    postPro.post_process(pst_out, L_FRAME);

    floats2shorts(pst_out, sp16);
  }
Example #5
0
 public int getElementType() {
   return Bits.maskBits(getLayoutHelper() >> LH_ELEMENT_TYPE_SHIFT, 0xFF);
 }
Example #6
0
 public int getLog2ElementSize() {
   return Bits.maskBits(getLayoutHelper() >> LH_LOG2_ELEMENT_SIZE_SHIFT, 0xFF);
 }
Example #7
0
 public long getArrayHeaderInBytes() {
   return Bits.maskBits(getLayoutHelper() >> LH_HEADER_SIZE_SHIFT, 0xFF);
 }