CSJ2K.j2k.codestream.reader.BitstreamReaderAgent.getCompImgWidth C# (CSharp) Метод

getCompImgWidth() публичный Метод

Returns the width in pixels of the specified component in the overall image, for the given (component) resolution level.

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

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

public getCompImgWidth ( int c, int rl ) : int
c int The index of the component, from 0 to N-1. /// ///
rl int The resolution level, from 0 to L. /// ///
Результат int
        public int getCompImgWidth(int c, int rl)
        {
            int sx, ex;
            int dl = decSpec.dls.getMinInComp(c) - rl;
            // indexation (0 is hi-res)
            // Calculate image starting x at component hi-res grid
            sx = (ax + hd.getCompSubsX(c) - 1) / hd.getCompSubsX(c);
            // Calculate image ending (excluding) x at component hi-res grid
            ex = (ax + imgW + hd.getCompSubsX(c) - 1) / hd.getCompSubsX(c);
            // The difference at the rl level is the width
            return (ex + (1 << dl) - 1) / (1 << dl) - (sx + (1 << dl) - 1) / (1 << dl);
        }