CSJ2K.j2k.entropy.encoder.StdEntropyCoder.getNextCodeBlock C# (CSharp) Method

getNextCodeBlock() public method

Returns the next coded code-block in the current tile for the specified component, as a copy (see below). The order in which code-blocks are returned is not specified. However each code-block is returned only once and all code-blocks will be returned if the method is called 'N' times, where 'N' is the number of code-blocks in the tile. After all the code-blocks have been returned for the current tile calls to this method will return 'null'.

When changing the current tile (through 'setTile()' or 'nextTile()') this method will always return the first code-block, as if this method was never called before for the new current tile.

The data returned by this method is always a copy of the internal data of this object, if any, and it can be modified "in place" without any problems after being returned.

public getNextCodeBlock ( int c, CSJ2K.j2k.entropy.encoder.CBlkRateDistStats ccb ) : CSJ2K.j2k.entropy.encoder.CBlkRateDistStats
c int The component for which to return the next code-block. /// ///
ccb CSJ2K.j2k.entropy.encoder.CBlkRateDistStats If non-null this object might be used in returning the coded /// code-block in this or any subsequent call to this method. If null a new /// one is created and returned. If the 'data' array of 'cbb' is not null /// it may be reused to return the compressed data. /// ///
return CSJ2K.j2k.entropy.encoder.CBlkRateDistStats
		public override CBlkRateDistStats getNextCodeBlock(int c, CBlkRateDistStats ccb)
		{
#if DO_TIMING
			long stime = 0L; // Start time for timed sections
#endif
			// Use single threaded implementation
			// Get code-block data from source
			srcblkT[0] = src.getNextInternCodeBlock(c, srcblkT[0]);
				
#if DO_TIMING
			stime = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
#endif

			if (srcblkT[0] == null)
			{
				// We got all code-blocks
				return null;
			}
			// Initialize thread local variables
			if ((opts[tIdx][c] & CSJ2K.j2k.entropy.StdEntropyCoderOptions.OPT_BYPASS) != 0 && boutT[0] == null)
			{
				boutT[0] = new BitToByteOutput(outT[0]);
			}
			// Initialize output code-block
			if (ccb == null)
			{
				ccb = new CBlkRateDistStats();
			}
			// Compress code-block
			compressCodeBlock(c, ccb, srcblkT[0], mqT[0], boutT[0], outT[0], stateT[0], distbufT[0], ratebufT[0], istermbufT[0], symbufT[0], ctxtbufT[0], opts[tIdx][c], isReversible(tIdx, c), lenCalc[tIdx][c], tType[tIdx][c]);
				
#if DO_TIMING
			time[c] += (System.DateTime.Now.Ticks - 621355968000000000) / 10000 - stime;
#endif

			// Return result
			return ccb;
		}