/** * Returns the maximum number of magnitude bits in any subband of the current tile if reversible * quantization is used * * @param sb The root of the subband tree of the current tile * @param c the component number * @return The highest number of magnitude bit-planes */ private int getMaxMagBitsRev(Subband sb, int c) { int tmp, max = 0; int g = ((Integer) gbs.getTileCompVal(tIdx, c)).intValue(); if (!sb.isNode) return g - 1 + src.getNomRangeBits(c) + sb.anGainExp; max = getMaxMagBitsRev(sb.getLL(), c); tmp = getMaxMagBitsRev(sb.getLH(), c); if (tmp > max) max = tmp; tmp = getMaxMagBitsRev(sb.getHL(), c); if (tmp > max) max = tmp; tmp = getMaxMagBitsRev(sb.getHH(), c); if (tmp > max) max = tmp; return max; }
/** * Returns the maximum number of magnitude bits in any subband in the given tile-component if * derived quantization is used * * @param sb The root of the subband tree of the tile-component * @param t Tile index * @param c Component index * @return The highest number of magnitude bit-planes */ private int getMaxMagBitsDerived(Subband sb, int t, int c) { int tmp, max = 0; int g = ((Integer) gbs.getTileCompVal(t, c)).intValue(); if (!sb.isNode) { float baseStep = ((Float) qsss.getTileCompVal(t, c)).floatValue(); return g - 1 + sb.level - (int) Math.floor(Math.log(baseStep) / log2); } max = getMaxMagBitsDerived(sb.getLL(), t, c); tmp = getMaxMagBitsDerived(sb.getLH(), t, c); if (tmp > max) max = tmp; tmp = getMaxMagBitsDerived(sb.getHL(), t, c); if (tmp > max) max = tmp; tmp = getMaxMagBitsDerived(sb.getHH(), t, c); if (tmp > max) max = tmp; return max; }
/** * Returns the maximum number of magnitude bits in any subband in the given tile-component if * expounded quantization is used * * @param sb The root of the subband tree of the tile-component * @param t Tile index * @param c Component index * @return The highest number of magnitude bit-planes */ private int getMaxMagBitsExpounded(Subband sb, int t, int c) { int tmp, max = 0; int g = ((Integer) gbs.getTileCompVal(t, c)).intValue(); if (!sb.isNode) { float baseStep = ((Float) qsss.getTileCompVal(t, c)).floatValue(); return g - 1 - (int) Math.floor( Math.log(baseStep / (((SubbandAn) sb).l2Norm * (1 << sb.anGainExp))) / log2); } max = getMaxMagBitsExpounded(sb.getLL(), t, c); tmp = getMaxMagBitsExpounded(sb.getLH(), t, c); if (tmp > max) max = tmp; tmp = getMaxMagBitsExpounded(sb.getHL(), t, c); if (tmp > max) max = tmp; tmp = getMaxMagBitsExpounded(sb.getHH(), t, c); if (tmp > max) max = tmp; return max; }