Exemple #1
0
  /**
   * Calculates the parameters of the SubbandAn objects that depend on the Quantizer. The 'stepWMSE'
   * field is calculated for each subband which is a leaf in the tree rooted at 'sb', for the
   * specified component. The subband tree 'sb' must be the one for the component 'n'.
   *
   * @param sb The root of the subband tree.
   * @param c The component index
   * @see SubbandAn#stepWMSE
   */
  protected void calcSbParams(SubbandAn sb, int c) {
    float baseStep;

    if (sb.stepWMSE > 0f) // parameters already calculated
    return;
    if (!sb.isNode) {
      if (isReversible(tIdx, c)) {
        sb.stepWMSE = (float) Math.pow(2, -(src.getNomRangeBits(c) << 1)) * sb.l2Norm * sb.l2Norm;
      } else {
        baseStep = ((Float) qsss.getTileCompVal(tIdx, c)).floatValue();
        if (isDerived(tIdx, c)) {
          sb.stepWMSE =
              baseStep
                  * baseStep
                  * (float) Math.pow(2, (sb.anGainExp - sb.level) << 1)
                  * sb.l2Norm
                  * sb.l2Norm;
        } else {
          sb.stepWMSE = baseStep * baseStep;
        }
      }
    } else {
      calcSbParams((SubbandAn) sb.getLL(), c);
      calcSbParams((SubbandAn) sb.getHL(), c);
      calcSbParams((SubbandAn) sb.getLH(), c);
      calcSbParams((SubbandAn) sb.getHH(), c);
      sb.stepWMSE = 1f; // Signal that we already calculated this branch
    }
  }
  /**
   * Performs the forward wavelet transform on the whole band. It iteratively decomposes the
   * subbands from the top node to the leaves.
   *
   * @param band The band containing the float data to decompose
   * @param subband The structure containing the coordinates of the current subband in the whole
   *     band to decompose.
   * @param c The index of the current component to decompose
   */
  private void waveletTreeDecomposition(DataBlk band, SubbandAn subband, int c) {

    // If the current subband is a leaf then nothing to be done (a leaf is
    // not decomposed).
    if (!subband.isNode) return;
    else {
      // Perform the 2D wavelet decomposition of the current subband
      wavelet2DDecomposition(band, (SubbandAn) subband, c);

      // Perform the decomposition of the four resulting subbands
      waveletTreeDecomposition(band, (SubbandAn) subband.getHH(), c);
      waveletTreeDecomposition(band, (SubbandAn) subband.getLH(), c);
      waveletTreeDecomposition(band, (SubbandAn) subband.getHL(), c);
      waveletTreeDecomposition(band, (SubbandAn) subband.getLL(), c);
    }
  }