Esempio n. 1
0
        public TilePartComponent(TilePart tilePart, TileComponent tileComponent)
        {
            TilePart = tilePart;

            TileComponent = tileComponent;

            COC = tilePart.Header.COC[TileComponent.Component.ComponentIndex];
            QCC = tilePart.Header.QCC[TileComponent.Component.ComponentIndex];

            var nResolutions = COC.SP_NumberOfDecompositionLevels + 1;

            ResolutionLevels = new ResolutionLevel[nResolutions];

            for (var iResolution = 0; iResolution < nResolutions; iResolution++)
            {
                ResolutionLevels[iResolution] = new ResolutionLevel(this, iResolution);
            }

            if (COC.SP_WaveletTransformUsed == WaveletTransform.Reversible_5_3)
            {
                ArithmeticType = ArithmeticType.Int32;
            }
            else if (COC.SP_WaveletTransformUsed == WaveletTransform.Irreversible_9_7)
            {
                ArithmeticType = ArithmeticType.Double;
            }
            else
            {
                throw NotSupported(COC.SP_WaveletTransformUsed);
            }
        }
Esempio n. 2
0
        public SubbandPrecinct(ResolutionLevel resolutionLevel, Subband subband, Precinct precinct)
        {
            ResolutionLevel = resolutionLevel;
            Subband         = subband;
            Precinct        = precinct;

            SubbandTileComponentSampleBounds_tb = ResolutionLevel.TilePartComponent.TileComponent.GetSubbandTileComponentSampleBounds_tb(subband);

            NCodeBlocksX = CeilDiv(SubbandTileComponentSampleBounds_tb.Width, ResolutionLevel.CodeBlockWidth);
            NCodeBlocksY = CeilDiv(SubbandTileComponentSampleBounds_tb.Height, ResolutionLevel.CodeBlockHeight);

            CodeBlockInclusionTagTree = new TagTree((uint)NCodeBlocksX, (uint)NCodeBlocksY);
            ZeroBitPlaneTagTree       = new TagTree((uint)NCodeBlocksX, (uint)NCodeBlocksY);

            CodeBlocks = new CodeBlock[NCodeBlocksY * NCodeBlocksX];

            var uRange = SubbandTileComponentSampleBounds_tb.XRange;
            var vRange = SubbandTileComponentSampleBounds_tb.YRange;

            TransformCoefficientValues = ResolutionLevel.TilePartComponent.ArithmeticType switch
            {
                ArithmeticType.Int32 => new Signal2D <int>(uRange, vRange),
                ArithmeticType.Single => new Signal2D <float>(uRange, vRange),
                ArithmeticType.Double => new Signal2D <double>(uRange, vRange),
                _ => throw NotSupported(ResolutionLevel.TilePartComponent.ArithmeticType)
            };
        }