CSJ2K.j2k.codestream.reader.PktDecoder.fillPrecInfo C# (CSharp) Method

fillPrecInfo() private method

Retrives precincts and code-blocks coordinates in the given resolution, level and component. Finishes TagTreeEncoder initialization as well.
private fillPrecInfo ( int c, int r, int mdl ) : void
c int Component index. /// ///
r int Resolution level index. /// ///
mdl int Number of decomposition level in component c. /// ///
return void
        private void fillPrecInfo(int c, int r, int mdl)
        {
            if (ppinfo[c][r].Length == 0)
                return ; // No precinct in this
            // resolution level

            Coord tileI = src.getTile(null);
            Coord nTiles = src.getNumTiles(null);

            int xsiz, ysiz, x0siz, y0siz;
            int xt0siz, yt0siz;
            int xtsiz, ytsiz;

            xt0siz = src.TilePartULX;
            yt0siz = src.TilePartULY;
            xtsiz = src.NomTileWidth;
            ytsiz = src.NomTileHeight;
            x0siz = hd.ImgULX;
            y0siz = hd.ImgULY;
            xsiz = hd.ImgWidth;
            ysiz = hd.ImgHeight;

            int tx0 = (tileI.x == 0)?x0siz:xt0siz + tileI.x * xtsiz;
            int ty0 = (tileI.y == 0)?y0siz:yt0siz + tileI.y * ytsiz;
            int tx1 = (tileI.x != nTiles.x - 1)?xt0siz + (tileI.x + 1) * xtsiz:xsiz;
            int ty1 = (tileI.y != nTiles.y - 1)?yt0siz + (tileI.y + 1) * ytsiz:ysiz;

            int xrsiz = hd.getCompSubsX(c);
            int yrsiz = hd.getCompSubsY(c);

            int tcx0 = src.getResULX(c, mdl);
            int tcy0 = src.getResULY(c, mdl);
            int tcx1 = tcx0 + src.getTileCompWidth(tIdx, c, mdl);
            int tcy1 = tcy0 + src.getTileCompHeight(tIdx, c, mdl);

            int ndl = mdl - r;
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int trx0 = (int) System.Math.Ceiling(tcx0 / (double) (1 << ndl));
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int try0 = (int) System.Math.Ceiling(tcy0 / (double) (1 << ndl));
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int trx1 = (int) System.Math.Ceiling(tcx1 / (double) (1 << ndl));
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int try1 = (int) System.Math.Ceiling(tcy1 / (double) (1 << ndl));

            int cb0x = src.CbULX;
            int cb0y = src.CbULY;

            double twoppx = (double) getPPX(tIdx, c, r);
            double twoppy = (double) getPPY(tIdx, c, r);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int twoppx2 = (int) (twoppx / 2);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int twoppy2 = (int) (twoppy / 2);

            // Precincts are located at (cb0x+i*twoppx,cb0y+j*twoppy)
            // Valid precincts are those which intersect with the current
            // resolution level
            int maxPrec = ppinfo[c][r].Length;
            int nPrec = 0;

            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int istart = (int) System.Math.Floor((try0 - cb0y) / twoppy);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int iend = (int) System.Math.Floor((try1 - 1 - cb0y) / twoppy);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int jstart = (int) System.Math.Floor((trx0 - cb0x) / twoppx);
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int jend = (int) System.Math.Floor((trx1 - 1 - cb0x) / twoppx);

            int acb0x, acb0y;

            SubbandSyn root = src.getSynSubbandTree(tIdx, c);
            SubbandSyn sb = null;

            int p0x, p0y, p1x, p1y; // Precinct projection in subband
            int s0x, s0y, s1x, s1y; // Active subband portion
            int cw, ch;
            int kstart, kend, lstart, lend, k0, l0;
            int prg_ulx, prg_uly;
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int prg_w = (int) twoppx << ndl;
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int prg_h = (int) twoppy << ndl;
            int tmp1, tmp2;

            CBlkCoordInfo cb;

            for (int i = istart; i <= iend; i++)
            {
                // Vertical precincts
                for (int j = jstart; j <= jend; j++, nPrec++)
                {
                    // Horizontal precincts
                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    if (j == jstart && (trx0 - cb0x) % (xrsiz * ((int) twoppx)) != 0)
                    {
                        prg_ulx = tx0;
                    }
                    else
                    {
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        prg_ulx = cb0x + j * xrsiz * ((int) twoppx << ndl);
                    }
                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    if (i == istart && (try0 - cb0y) % (yrsiz * ((int) twoppy)) != 0)
                    {
                        prg_uly = ty0;
                    }
                    else
                    {
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        prg_uly = cb0y + i * yrsiz * ((int) twoppy << ndl);
                    }

                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                    ppinfo[c][r][nPrec] = new PrecInfo(r, (int) (cb0x + j * twoppx), (int) (cb0y + i * twoppy), (int) twoppx, (int) twoppy, prg_ulx, prg_uly, prg_w, prg_h);

                    if (r == 0)
                    {
                        // LL subband
                        acb0x = cb0x;
                        acb0y = cb0y;

                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        p0x = acb0x + j * (int) twoppx;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        p1x = p0x + (int) twoppx;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        p0y = acb0y + i * (int) twoppy;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        p1y = p0y + (int) twoppy;

                        sb = (SubbandSyn) root.getSubbandByIdx(0, 0);
                        s0x = (p0x < sb.ulcx)?sb.ulcx:p0x;
                        s1x = (p1x > sb.ulcx + sb.w)?sb.ulcx + sb.w:p1x;
                        s0y = (p0y < sb.ulcy)?sb.ulcy:p0y;
                        s1y = (p1y > sb.ulcy + sb.h)?sb.ulcy + sb.h:p1y;

                        // Code-blocks are located at (acb0x+k*cw,acb0y+l*ch)
                        cw = sb.nomCBlkW;
                        ch = sb.nomCBlkH;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        k0 = (int) System.Math.Floor((sb.ulcy - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kstart = (int) System.Math.Floor((s0y - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kend = (int) System.Math.Floor((s1y - 1 - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        l0 = (int) System.Math.Floor((sb.ulcx - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lstart = (int) System.Math.Floor((s0x - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lend = (int) System.Math.Floor((s1x - 1 - acb0x) / (double) cw);

                        if (s1x - s0x <= 0 || s1y - s0y <= 0)
                        {
                            ppinfo[c][r][nPrec].nblk[0] = 0;
                            ttIncl[c][r][nPrec][0] = new TagTreeDecoder(0, 0);
                            ttMaxBP[c][r][nPrec][0] = new TagTreeDecoder(0, 0);
                        }
                        else
                        {
                            ttIncl[c][r][nPrec][0] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            ttMaxBP[c][r][nPrec][0] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            CBlkCoordInfo[][] tmpArray = new CBlkCoordInfo[kend - kstart + 1][];
                            for (int i2 = 0; i2 < kend - kstart + 1; i2++)
                            {
                                tmpArray[i2] = new CBlkCoordInfo[lend - lstart + 1];
                            }
                            ppinfo[c][r][nPrec].cblk[0] = tmpArray;
                            ppinfo[c][r][nPrec].nblk[0] = (kend - kstart + 1) * (lend - lstart + 1);

                            for (int k = kstart; k <= kend; k++)
                            {
                                // Vertical cblks
                                for (int l = lstart; l <= lend; l++)
                                {
                                    // Horiz. cblks
                                    cb = new CBlkCoordInfo(k - k0, l - l0);
                                    if (l == l0)
                                    {
                                        cb.ulx = sb.ulx;
                                    }
                                    else
                                    {
                                        cb.ulx = sb.ulx + l * cw - (sb.ulcx - acb0x);
                                    }
                                    if (k == k0)
                                    {
                                        cb.uly = sb.uly;
                                    }
                                    else
                                    {
                                        cb.uly = sb.uly + k * ch - (sb.ulcy - acb0y);
                                    }
                                    tmp1 = acb0x + l * cw;
                                    tmp1 = (tmp1 > sb.ulcx)?tmp1:sb.ulcx;
                                    tmp2 = acb0x + (l + 1) * cw;
                                    tmp2 = (tmp2 > sb.ulcx + sb.w)?sb.ulcx + sb.w:tmp2;
                                    cb.w = tmp2 - tmp1;
                                    tmp1 = acb0y + k * ch;
                                    tmp1 = (tmp1 > sb.ulcy)?tmp1:sb.ulcy;
                                    tmp2 = acb0y + (k + 1) * ch;
                                    tmp2 = (tmp2 > sb.ulcy + sb.h)?sb.ulcy + sb.h:tmp2;
                                    cb.h = tmp2 - tmp1;
                                    ppinfo[c][r][nPrec].cblk[0][k - kstart][l - lstart] = cb;
                                } // Horizontal code-blocks
                            } // Vertical code-blocks
                        }
                    }
                    else
                    {
                        // HL, LH and HH subbands
                        // HL subband
                        acb0x = 0;
                        acb0y = cb0y;

                        p0x = acb0x + j * twoppx2;
                        p1x = p0x + twoppx2;
                        p0y = acb0y + i * twoppy2;
                        p1y = p0y + twoppy2;

                        sb = (SubbandSyn) root.getSubbandByIdx(r, 1);
                        s0x = (p0x < sb.ulcx)?sb.ulcx:p0x;
                        s1x = (p1x > sb.ulcx + sb.w)?sb.ulcx + sb.w:p1x;
                        s0y = (p0y < sb.ulcy)?sb.ulcy:p0y;
                        s1y = (p1y > sb.ulcy + sb.h)?sb.ulcy + sb.h:p1y;

                        // Code-blocks are located at (acb0x+k*cw,acb0y+l*ch)
                        cw = sb.nomCBlkW;
                        ch = sb.nomCBlkH;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        k0 = (int) System.Math.Floor((sb.ulcy - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kstart = (int) System.Math.Floor((s0y - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kend = (int) System.Math.Floor((s1y - 1 - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        l0 = (int) System.Math.Floor((sb.ulcx - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lstart = (int) System.Math.Floor((s0x - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lend = (int) System.Math.Floor((s1x - 1 - acb0x) / (double) cw);

                        if (s1x - s0x <= 0 || s1y - s0y <= 0)
                        {
                            ppinfo[c][r][nPrec].nblk[1] = 0;
                            ttIncl[c][r][nPrec][1] = new TagTreeDecoder(0, 0);
                            ttMaxBP[c][r][nPrec][1] = new TagTreeDecoder(0, 0);
                        }
                        else
                        {
                            ttIncl[c][r][nPrec][1] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            ttMaxBP[c][r][nPrec][1] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            CBlkCoordInfo[][] tmpArray2 = new CBlkCoordInfo[kend - kstart + 1][];
                            for (int i3 = 0; i3 < kend - kstart + 1; i3++)
                            {
                                tmpArray2[i3] = new CBlkCoordInfo[lend - lstart + 1];
                            }
                            ppinfo[c][r][nPrec].cblk[1] = tmpArray2;
                            ppinfo[c][r][nPrec].nblk[1] = (kend - kstart + 1) * (lend - lstart + 1);

                            for (int k = kstart; k <= kend; k++)
                            {
                                // Vertical cblks
                                for (int l = lstart; l <= lend; l++)
                                {
                                    // Horiz. cblks
                                    cb = new CBlkCoordInfo(k - k0, l - l0);
                                    if (l == l0)
                                    {
                                        cb.ulx = sb.ulx;
                                    }
                                    else
                                    {
                                        cb.ulx = sb.ulx + l * cw - (sb.ulcx - acb0x);
                                    }
                                    if (k == k0)
                                    {
                                        cb.uly = sb.uly;
                                    }
                                    else
                                    {
                                        cb.uly = sb.uly + k * ch - (sb.ulcy - acb0y);
                                    }
                                    tmp1 = acb0x + l * cw;
                                    tmp1 = (tmp1 > sb.ulcx)?tmp1:sb.ulcx;
                                    tmp2 = acb0x + (l + 1) * cw;
                                    tmp2 = (tmp2 > sb.ulcx + sb.w)?sb.ulcx + sb.w:tmp2;
                                    cb.w = tmp2 - tmp1;
                                    tmp1 = acb0y + k * ch;
                                    tmp1 = (tmp1 > sb.ulcy)?tmp1:sb.ulcy;
                                    tmp2 = acb0y + (k + 1) * ch;
                                    tmp2 = (tmp2 > sb.ulcy + sb.h)?sb.ulcy + sb.h:tmp2;
                                    cb.h = tmp2 - tmp1;
                                    ppinfo[c][r][nPrec].cblk[1][k - kstart][l - lstart] = cb;
                                } // Horizontal code-blocks
                            } // Vertical code-blocks
                        }

                        // LH subband
                        acb0x = cb0x;
                        acb0y = 0;

                        p0x = acb0x + j * twoppx2;
                        p1x = p0x + twoppx2;
                        p0y = acb0y + i * twoppy2;
                        p1y = p0y + twoppy2;

                        sb = (SubbandSyn) root.getSubbandByIdx(r, 2);
                        s0x = (p0x < sb.ulcx)?sb.ulcx:p0x;
                        s1x = (p1x > sb.ulcx + sb.w)?sb.ulcx + sb.w:p1x;
                        s0y = (p0y < sb.ulcy)?sb.ulcy:p0y;
                        s1y = (p1y > sb.ulcy + sb.h)?sb.ulcy + sb.h:p1y;

                        // Code-blocks are located at (acb0x+k*cw,acb0y+l*ch)
                        cw = sb.nomCBlkW;
                        ch = sb.nomCBlkH;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        k0 = (int) System.Math.Floor((sb.ulcy - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kstart = (int) System.Math.Floor((s0y - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kend = (int) System.Math.Floor((s1y - 1 - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        l0 = (int) System.Math.Floor((sb.ulcx - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lstart = (int) System.Math.Floor((s0x - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lend = (int) System.Math.Floor((s1x - 1 - acb0x) / (double) cw);

                        if (s1x - s0x <= 0 || s1y - s0y <= 0)
                        {
                            ppinfo[c][r][nPrec].nblk[2] = 0;
                            ttIncl[c][r][nPrec][2] = new TagTreeDecoder(0, 0);
                            ttMaxBP[c][r][nPrec][2] = new TagTreeDecoder(0, 0);
                        }
                        else
                        {
                            ttIncl[c][r][nPrec][2] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            ttMaxBP[c][r][nPrec][2] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            CBlkCoordInfo[][] tmpArray3 = new CBlkCoordInfo[kend - kstart + 1][];
                            for (int i4 = 0; i4 < kend - kstart + 1; i4++)
                            {
                                tmpArray3[i4] = new CBlkCoordInfo[lend - lstart + 1];
                            }
                            ppinfo[c][r][nPrec].cblk[2] = tmpArray3;
                            ppinfo[c][r][nPrec].nblk[2] = (kend - kstart + 1) * (lend - lstart + 1);

                            for (int k = kstart; k <= kend; k++)
                            {
                                // Vertical cblks
                                for (int l = lstart; l <= lend; l++)
                                {
                                    // Horiz cblks
                                    cb = new CBlkCoordInfo(k - k0, l - l0);
                                    if (l == l0)
                                    {
                                        cb.ulx = sb.ulx;
                                    }
                                    else
                                    {
                                        cb.ulx = sb.ulx + l * cw - (sb.ulcx - acb0x);
                                    }
                                    if (k == k0)
                                    {
                                        cb.uly = sb.uly;
                                    }
                                    else
                                    {
                                        cb.uly = sb.uly + k * ch - (sb.ulcy - acb0y);
                                    }
                                    tmp1 = acb0x + l * cw;
                                    tmp1 = (tmp1 > sb.ulcx)?tmp1:sb.ulcx;
                                    tmp2 = acb0x + (l + 1) * cw;
                                    tmp2 = (tmp2 > sb.ulcx + sb.w)?sb.ulcx + sb.w:tmp2;
                                    cb.w = tmp2 - tmp1;
                                    tmp1 = acb0y + k * ch;
                                    tmp1 = (tmp1 > sb.ulcy)?tmp1:sb.ulcy;
                                    tmp2 = acb0y + (k + 1) * ch;
                                    tmp2 = (tmp2 > sb.ulcy + sb.h)?sb.ulcy + sb.h:tmp2;
                                    cb.h = tmp2 - tmp1;
                                    ppinfo[c][r][nPrec].cblk[2][k - kstart][l - lstart] = cb;
                                } // Horizontal code-blocks
                            } // Vertical code-blocks
                        }

                        // HH subband
                        acb0x = 0;
                        acb0y = 0;

                        p0x = acb0x + j * twoppx2;
                        p1x = p0x + twoppx2;
                        p0y = acb0y + i * twoppy2;
                        p1y = p0y + twoppy2;

                        sb = (SubbandSyn) root.getSubbandByIdx(r, 3);
                        s0x = (p0x < sb.ulcx)?sb.ulcx:p0x;
                        s1x = (p1x > sb.ulcx + sb.w)?sb.ulcx + sb.w:p1x;
                        s0y = (p0y < sb.ulcy)?sb.ulcy:p0y;
                        s1y = (p1y > sb.ulcy + sb.h)?sb.ulcy + sb.h:p1y;

                        // Code-blocks are located at (acb0x+k*cw,acb0y+l*ch)
                        cw = sb.nomCBlkW;
                        ch = sb.nomCBlkH;
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        k0 = (int) System.Math.Floor((sb.ulcy - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kstart = (int) System.Math.Floor((s0y - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        kend = (int) System.Math.Floor((s1y - 1 - acb0y) / (double) ch);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        l0 = (int) System.Math.Floor((sb.ulcx - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lstart = (int) System.Math.Floor((s0x - acb0x) / (double) cw);
                        //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                        lend = (int) System.Math.Floor((s1x - 1 - acb0x) / (double) cw);

                        if (s1x - s0x <= 0 || s1y - s0y <= 0)
                        {
                            ppinfo[c][r][nPrec].nblk[3] = 0;
                            ttIncl[c][r][nPrec][3] = new TagTreeDecoder(0, 0);
                            ttMaxBP[c][r][nPrec][3] = new TagTreeDecoder(0, 0);
                        }
                        else
                        {
                            ttIncl[c][r][nPrec][3] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            ttMaxBP[c][r][nPrec][3] = new TagTreeDecoder(kend - kstart + 1, lend - lstart + 1);
                            CBlkCoordInfo[][] tmpArray4 = new CBlkCoordInfo[kend - kstart + 1][];
                            for (int i5 = 0; i5 < kend - kstart + 1; i5++)
                            {
                                tmpArray4[i5] = new CBlkCoordInfo[lend - lstart + 1];
                            }
                            ppinfo[c][r][nPrec].cblk[3] = tmpArray4;
                            ppinfo[c][r][nPrec].nblk[3] = (kend - kstart + 1) * (lend - lstart + 1);

                            for (int k = kstart; k <= kend; k++)
                            {
                                // Vertical cblks
                                for (int l = lstart; l <= lend; l++)
                                {
                                    // Horiz cblks
                                    cb = new CBlkCoordInfo(k - k0, l - l0);
                                    if (l == l0)
                                    {
                                        cb.ulx = sb.ulx;
                                    }
                                    else
                                    {
                                        cb.ulx = sb.ulx + l * cw - (sb.ulcx - acb0x);
                                    }
                                    if (k == k0)
                                    {
                                        cb.uly = sb.uly;
                                    }
                                    else
                                    {
                                        cb.uly = sb.uly + k * ch - (sb.ulcy - acb0y);
                                    }
                                    tmp1 = acb0x + l * cw;
                                    tmp1 = (tmp1 > sb.ulcx)?tmp1:sb.ulcx;
                                    tmp2 = acb0x + (l + 1) * cw;
                                    tmp2 = (tmp2 > sb.ulcx + sb.w)?sb.ulcx + sb.w:tmp2;
                                    cb.w = tmp2 - tmp1;
                                    tmp1 = acb0y + k * ch;
                                    tmp1 = (tmp1 > sb.ulcy)?tmp1:sb.ulcy;
                                    tmp2 = acb0y + (k + 1) * ch;
                                    tmp2 = (tmp2 > sb.ulcy + sb.h)?sb.ulcy + sb.h:tmp2;
                                    cb.h = tmp2 - tmp1;
                                    ppinfo[c][r][nPrec].cblk[3][k - kstart][l - lstart] = cb;
                                } // Horizontal code-blocks
                            } // Vertical code-blocks
                        }
                    }
                } // Horizontal precincts
            } // Vertical precincts
        }