CSJ2K.j2k.codestream.reader.BitstreamReaderAgent.getTileHeight C# (CSharp) Method

getTileHeight() public method

Returns the overall height of the current tile in pixels, for the given resolution level. This is the tile's height without accounting for any component subsampling.

Note: Tile resolution level indexes may be different from tile-component resolution index. They are indeed indexed starting from the lowest number of decomposition levels of each component of the tile.

For an image (1 tile) with 2 components (component 0 having 2 decomposition levels and component 1 having 3 decomposition levels), the first (tile-)component has 3 resolution levels and the second one has 4 resolution levels, whereas the tile has only 3 resolution levels available.

public getTileHeight ( int rl ) : int
rl int The (tile) resolution level. /// ///
return int
        public virtual int getTileHeight(int rl)
        {
            // The minumum number of decomposition levels between all the
            // components
            int mindl = decSpec.dls.getMinInTile(TileIdx);
            if (rl > mindl)
            {
                throw new System.ArgumentException("Requested resolution level" + " is not available for, at " + "least, one component in" + " tile: " + ctX + "x" + ctY);
            }

            int ctuly, ntuly;
            int dl = mindl - rl; // Number of decomposition to obtain this
            // resolution

            // Calculate starting Y of current tile at hi-res
            ctuly = (ctY == 0)?ay:py + ctY * ntH;
            // Calculate starting Y of next tile Y-wise at hi-res
            ntuly = (ctY < ntY - 1)?py + (ctY + 1) * ntH:ay + imgH;
            // The difference at the rl level is the height
            return (ntuly + (1 << dl) - 1) / (1 << dl) - (ctuly + (1 << dl) - 1) / (1 << dl);
        }