/// <summary> Creates a new packet encoder object, using the information from the /// 'infoSrc' object. /// /// </summary> /// <param name="infoSrc">The source of information to construct the object. /// /// </param> /// <param name="encSpec">The encoding parameters. /// /// </param> /// <param name="numPrec">Maximum number of precincts in each tile, component /// and resolution level. /// /// </param> /// <param name="pl">ParameterList instance that holds command line options /// /// </param> public PktEncoder(CodedCBlkDataSrcEnc infoSrc, EncoderSpecs encSpec, Coord[][][] numPrec, ParameterList pl) { this.infoSrc = infoSrc; this.encSpec = encSpec; // Check parameters pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo)); // Get number of components and tiles int nc = infoSrc.NumComps; int nt = infoSrc.getNumTiles(); // Do initial allocation ttIncl = new TagTreeEncoder[nt][][][][]; for (int i = 0; i < nt; i++) { ttIncl[i] = new TagTreeEncoder[nc][][][]; } ttMaxBP = new TagTreeEncoder[nt][][][][]; for (int i2 = 0; i2 < nt; i2++) { ttMaxBP[i2] = new TagTreeEncoder[nc][][][]; } lblock = new int[nt][][][][]; for (int i3 = 0; i3 < nt; i3++) { lblock[i3] = new int[nc][][][]; } prevtIdxs = new int[nt][][][][]; for (int i4 = 0; i4 < nt; i4++) { prevtIdxs[i4] = new int[nc][][][]; } ppinfo = new PrecInfo[nt][][][]; for (int i5 = 0; i5 < nt; i5++) { ppinfo[i5] = new PrecInfo[nc][][]; } // Finish allocation SubbandAn root, sb; int maxs, mins; int mrl; //Coord tmpCoord = null; int numcb; // Number of code-blocks //System.Collections.ArrayList cblks = null; infoSrc.setTile(0, 0); for (int t = 0; t < nt; t++) { // Loop on tiles for (int c = 0; c < nc; c++) { // Loop on components // Get number of resolution levels root = infoSrc.getAnSubbandTree(t, c); mrl = root.resLvl; lblock[t][c] = new int[mrl + 1][][]; ttIncl[t][c] = new TagTreeEncoder[mrl + 1][][]; ttMaxBP[t][c] = new TagTreeEncoder[mrl + 1][][]; prevtIdxs[t][c] = new int[mrl + 1][][]; ppinfo[t][c] = new PrecInfo[mrl + 1][]; for (int r = 0; r <= mrl; r++) { // Loop on resolution levels mins = (r == 0)?0:1; maxs = (r == 0)?1:4; int maxPrec = numPrec[t][c][r].x * numPrec[t][c][r].y; ttIncl[t][c][r] = new TagTreeEncoder[maxPrec][]; for (int i6 = 0; i6 < maxPrec; i6++) { ttIncl[t][c][r][i6] = new TagTreeEncoder[maxs]; } ttMaxBP[t][c][r] = new TagTreeEncoder[maxPrec][]; for (int i7 = 0; i7 < maxPrec; i7++) { ttMaxBP[t][c][r][i7] = new TagTreeEncoder[maxs]; } prevtIdxs[t][c][r] = new int[maxs][]; lblock[t][c][r] = new int[maxs][]; // Precincts and code-blocks ppinfo[t][c][r] = new PrecInfo[maxPrec]; fillPrecInfo(t, c, r); for (int s = mins; s < maxs; s++) { // Loop on subbands sb = (SubbandAn) root.getSubbandByIdx(r, s); numcb = sb.numCb.x * sb.numCb.y; lblock[t][c][r][s] = new int[numcb]; ArrayUtil.intArraySet(lblock[t][c][r][s], INIT_LBLOCK); prevtIdxs[t][c][r][s] = new int[numcb]; ArrayUtil.intArraySet(prevtIdxs[t][c][r][s], - 1); } } } if (t != nt - 1) infoSrc.nextTile(); } }
/// <summary> Retrives precincts and code-blocks coordinates in the given resolution, /// component and tile. It terminates TagTreeEncoder initialization as /// well. /// /// </summary> /// <param name="t">Tile index. /// /// </param> /// <param name="c">Component index. /// /// </param> /// <param name="r">Resolution level index. /// /// </param> private void fillPrecInfo(int t, int c, int r) { if (ppinfo[t][c][r].Length == 0) return ; // No precinct in this // resolution level Coord tileI = infoSrc.getTile(null); Coord nTiles = infoSrc.getNumTiles(null); int x0siz = infoSrc.ImgULX; int y0siz = infoSrc.ImgULY; int xsiz = x0siz + infoSrc.ImgWidth; int ysiz = y0siz + infoSrc.ImgHeight; int xt0siz = infoSrc.TilePartULX; int yt0siz = infoSrc.TilePartULY; int xtsiz = infoSrc.NomTileWidth; int ytsiz = infoSrc.NomTileHeight; 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 = infoSrc.getCompSubsX(c); int yrsiz = infoSrc.getCompSubsY(c); //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 tcx0 = (int) System.Math.Ceiling(tx0 / (double) (xrsiz)); //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 tcy0 = (int) System.Math.Ceiling(ty0 / (double) (yrsiz)); //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 tcx1 = (int) System.Math.Ceiling(tx1 / (double) (xrsiz)); //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 tcy1 = (int) System.Math.Ceiling(ty1 / (double) (yrsiz)); int ndl = infoSrc.getAnSubbandTree(t, c).resLvl - 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 = infoSrc.CbULX; int cb0y = infoSrc.CbULY; double twoppx = (double) encSpec.pss.getPPX(t, c, r); double twoppy = (double) encSpec.pss.getPPY(t, 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[t][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; SubbandAn root = infoSrc.getAnSubbandTree(t, c); SubbandAn 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; 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[t][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 = (SubbandAn) 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[t][c][r][nPrec].nblk[0] = 0; ttIncl[t][c][r][nPrec][0] = new TagTreeEncoder(0, 0); ttMaxBP[t][c][r][nPrec][0] = new TagTreeEncoder(0, 0); } else { ttIncl[t][c][r][nPrec][0] = new TagTreeEncoder(kend - kstart + 1, lend - lstart + 1); ttMaxBP[t][c][r][nPrec][0] = new TagTreeEncoder(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[t][c][r][nPrec].cblk[0] = tmpArray; ppinfo[t][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); ppinfo[t][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 = (SubbandAn) 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[t][c][r][nPrec].nblk[1] = 0; ttIncl[t][c][r][nPrec][1] = new TagTreeEncoder(0, 0); ttMaxBP[t][c][r][nPrec][1] = new TagTreeEncoder(0, 0); } else { ttIncl[t][c][r][nPrec][1] = new TagTreeEncoder(kend - kstart + 1, lend - lstart + 1); ttMaxBP[t][c][r][nPrec][1] = new TagTreeEncoder(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[t][c][r][nPrec].cblk[1] = tmpArray2; ppinfo[t][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); ppinfo[t][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 = (SubbandAn) 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[t][c][r][nPrec].nblk[2] = 0; ttIncl[t][c][r][nPrec][2] = new TagTreeEncoder(0, 0); ttMaxBP[t][c][r][nPrec][2] = new TagTreeEncoder(0, 0); } else { ttIncl[t][c][r][nPrec][2] = new TagTreeEncoder(kend - kstart + 1, lend - lstart + 1); ttMaxBP[t][c][r][nPrec][2] = new TagTreeEncoder(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[t][c][r][nPrec].cblk[2] = tmpArray3; ppinfo[t][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); ppinfo[t][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 = (SubbandAn) 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[t][c][r][nPrec].nblk[3] = 0; ttIncl[t][c][r][nPrec][3] = new TagTreeEncoder(0, 0); ttMaxBP[t][c][r][nPrec][3] = new TagTreeEncoder(0, 0); } else { ttIncl[t][c][r][nPrec][3] = new TagTreeEncoder(kend - kstart + 1, lend - lstart + 1); ttMaxBP[t][c][r][nPrec][3] = new TagTreeEncoder(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[t][c][r][nPrec].cblk[3] = tmpArray4; ppinfo[t][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); ppinfo[t][c][r][nPrec].cblk[3][k - kstart][l - lstart] = cb; } // Horizontal code-blocks } // Vertical code-blocks } } } // Horizontal precincts } // Vertical precincts }