/**
   * Codebook Search Unquantification (Split Shape).
   *
   * @param exc - excitation array.
   * @param es - position in excitation array.
   * @param nsf - number of samples in subframe.
   * @param bits - Speex bits buffer.
   */
  public final void unquant(float[] exc, int es, int nsf, @NotNull Bits bits) {
    int i, j;

    /* Decode codewords and gains */
    for (i = 0; i < nb_subvect; i++) {
      if (have_sign != 0) signs[i] = bits.unpack(1);
      else signs[i] = 0;
      ind[i] = bits.unpack(shape_bits);
    }

    /* Compute decoded excitation */
    for (i = 0; i < nb_subvect; i++) {
      float s = 1.0f;
      if (signs[i] != 0) s = -1.0f;
      for (j = 0; j < subvect_size; j++) {
        exc[es + subvect_size * i + j] +=
            s * 0.03125f * (float) shape_cb[ind[i] * subvect_size + j];
      }
    }
  }