/// <summary> Calculates the maximum amount of magnitude bits for each
        /// tile-component, and stores it in the 'maxMagBits' array. This is called
        /// by the constructor
        ///
        /// </summary>
        /// <param name="encSpec">The encoder specifications for addition of roi specs
        ///
        /// </param>
        private void  calcMaxMagBits(EncoderSpecs encSpec)
        {
            int          tmp;
            MaxShiftSpec rois = encSpec.rois;

            int nt = src.getNumTiles();
            int nc = src.NumComps;

            maxMagBits = new int[nt][];
            for (int i = 0; i < nt; i++)
            {
                maxMagBits[i] = new int[nc];
            }

            src.setTile(0, 0);
            for (int t = 0; t < nt; t++)
            {
                for (int c = nc - 1; c >= 0; c--)
                {
                    tmp = src.getMaxMagBits(c);
                    maxMagBits[t][c] = tmp;
                    rois.setTileCompVal(t, c, (System.Object)tmp);
                }
                if (t < nt - 1)
                {
                    src.nextTile();
                }
            }
            // Reset to current initial tile position
            src.setTile(0, 0);
        }