public final void quant(final float[] lsp,
                          final float[] qlsp,
                          final int order,
                          final Bits bits)
  {
    int i;
    float tmp1, tmp2;
    int id;
    float[] quant_weight = new float[MAX_LSP_SIZE];

    for (i=0;i<order;i++)
      qlsp[i]=lsp[i];
    quant_weight[0] = 1/(qlsp[1]-qlsp[0]);
    quant_weight[order-1] = 1/(qlsp[order-1]-qlsp[order-2]);
    for (i=1;i<order-1;i++)
    {
      tmp1 = 1/(qlsp[i]-qlsp[i-1]);
      tmp2 = 1/(qlsp[i+1]-qlsp[i]);
      quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
    }

    for (i=0;i<order;i++)
      qlsp[i]-=(.3125*i+.75);
    for (i=0;i<order;i++)
      qlsp[i]*=256;
    id = lsp_quant(qlsp, 0, high_lsp_cdbk, 64, order);
    bits.pack(id, 6);

    for (i=0;i<order;i++)
      qlsp[i]*=2;
    id = lsp_weight_quant(qlsp, 0, quant_weight, 0, high_lsp_cdbk2, 64, order);
    bits.pack(id, 6);

    for (i=0;i<order;i++)
      qlsp[i]*=0.0019531;
    for (i=0;i<order;i++)
      qlsp[i]=lsp[i]-qlsp[i];
  }