CSJ2K.j2k.codestream.writer.PktEncoder.PktEncoder C# (CSharp) Метод

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

Creates a new packet encoder object, using the information from the 'infoSrc' object.
public PktEncoder ( CodedCBlkDataSrcEnc infoSrc, CSJ2K.j2k.encoder.EncoderSpecs encSpec, Coord numPrec, CSJ2K.j2k.util.ParameterList pl ) : System
infoSrc CodedCBlkDataSrcEnc The source of information to construct the object. /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs The encoding parameters. /// ///
numPrec Coord Maximum number of precincts in each tile, component /// and resolution level. /// ///
pl CSJ2K.j2k.util.ParameterList ParameterList instance that holds command line options /// ///
Результат System
        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();
            }
        }