CSJ2K.j2k.codestream.reader.FileBitstreamReaderAgent.setTile C# (CSharp) Méthode

setTile() public méthode

Changes the current tile, given the new indexes. An IllegalArgumentException is thrown if the indexes do not correspond to a valid tile.
public setTile ( int x, int y ) : void
x int The horizontal indexes the tile. /// ///
y int The vertical indexes of the new tile. /// ///
Résultat void
        public override void setTile(int x, int y)
        {
            int i; // counter
            // Check validity of tile indexes
            if (x < 0 || y < 0 || x >= ntX || y >= ntY)
            {
                throw new System.ArgumentException();
            }
            int t = (y * ntX + x);

            // Reset number of read bytes if needed
            if (t == 0)
            {
                anbytes = headLen;
                if (!isTruncMode)
                {
                    anbytes += 2;
                }
                // Restore values of nBytes
                for (int tIdx = 0; tIdx < nt; tIdx++)
                {
                    nBytes[tIdx] = baknBytes[tIdx];
                }
            }

            // Set the new current tile
            ctX = x;
            ctY = y;
            // Calculate tile relative points
            int ctox = (x == 0)?ax:px + x * ntW;
            int ctoy = (y == 0)?ay:py + y * ntH;
            for (i = nc - 1; i >= 0; i--)
            {
                culx[i] = (ctox + hd.getCompSubsX(i) - 1) / hd.getCompSubsX(i);
                culy[i] = (ctoy + hd.getCompSubsY(i) - 1) / hd.getCompSubsY(i);
                offX[i] = (px + x * ntW + hd.getCompSubsX(i) - 1) / hd.getCompSubsX(i);
                offY[i] = (py + y * ntH + hd.getCompSubsY(i) - 1) / hd.getCompSubsY(i);
            }

            // Initialize subband tree and number of resolution levels
            subbTrees = new SubbandSyn[nc];
            mdl = new int[nc];
            derived = new bool[nc];
            params_Renamed = new StdDequantizerParams[nc];
            gb = new int[nc];

            for (int c = 0; c < nc; c++)
            {
                derived[c] = decSpec.qts.isDerived(t, c);
                params_Renamed[c] = (StdDequantizerParams) decSpec.qsss.getTileCompVal(t, c);
                gb[c] = ((System.Int32) decSpec.gbs.getTileCompVal(t, c));
                mdl[c] = ((System.Int32) decSpec.dls.getTileCompVal(t, c));

                subbTrees[c] = new SubbandSyn(getTileCompWidth(t, c, mdl[c]), getTileCompHeight(t, c, mdl[c]), getResULX(c, mdl[c]), getResULY(c, mdl[c]), mdl[c], decSpec.wfs.getHFilters(t, c), decSpec.wfs.getVFilters(t, c));
                initSubbandsFields(c, subbTrees[c]);
            }

            // Read tile's packets
            try
            {
                readTilePkts(t);
            }
            catch (System.IO.IOException e)
            {
                SupportClass.WriteStackTrace(e);
                throw new System.InvalidOperationException("IO Error when reading tile " + x + " x " + y);
            }
        }