CSJ2K.j2k.codestream.reader.FileBitstreamReaderAgent.allocateRate C# (CSharp) Method

allocateRate() private method

Allocates output bit-rate for each tile in parsing mode: The allocator simulates the truncation of a virtual layer-resolution progressive codestream.
private allocateRate ( ) : void
return void
        private void allocateRate()
        {
            int stopOff = tnbytes;

            // In parsing mode, the bitrate is allocated related to each tile's
            // length in the bit stream

            // EOC marker's length
            anbytes += 2;

            // If there are too few bytes to read the tile part headers throw an
            // error
            if (anbytes > stopOff)
            {
                throw new System.InvalidOperationException("Requested bitrate is too small for parsing");
            }

            // Calculate bitrate for each tile
            int rem = stopOff - anbytes;
            int totnByte = rem;
            for (int t = nt - 1; t > 0; t--)
            {
                //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'"
                rem -= (nBytes[t] = (int) (totnByte * (totTileLen[t] / totAllTileLen)));
            }
            nBytes[0] = rem;
        }