Ejemplo n.º 1
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)
            };
        }
Ejemplo n.º 2
0
        public SubbandPrecinct GetSubbandPrecinct(Subband subband)
        {
            // TODO: Add support for precincts
            var subbandPrecinct = SubbandPrecincts.FirstOrDefault(o => o.Subband == subband);

            if (subbandPrecinct == null)
            {
                subbandPrecinct = new SubbandPrecinct(this, subband, new Precinct());
                SubbandPrecincts.Add(subbandPrecinct);
            }
            return(subbandPrecinct);
        }
Ejemplo n.º 3
0
        public Rectangle GetSubbandTileComponentSampleBounds_tb(Subband subBand)
        {
            var tc = TileComponentSampleBounds_tc;

            var xo = (subBand.SubbandType.HorizontalFilter == SubbandType.Filter.HighPass) ? 1 : 0;
            var yo = (subBand.SubbandType.VerticalFilter == SubbandType.Filter.HighPass) ? 1 : 0;

            var nb = subBand.DecompositionLevel;

            var m = 1 << (nb - 1);
            var d = 1 << nb;

            var dtcx = m * xo;
            var dtcy = m * yo;

            var tbx0 = CeilDiv(tc.X0 - dtcx, d);
            var tby0 = CeilDiv(tc.Y0 - dtcy, d);
            var tbx1 = CeilDiv(tc.X1 - dtcx, d);
            var tby1 = CeilDiv(tc.Y1 - dtcy, d);

            return(new Rectangle(tbx0, tby0, tbx1, tby1));
        }
Ejemplo n.º 4
0
 public CodeBlock(Subband subband, Rectangle bounds)
 {
     Subband = subband;
     Bounds  = bounds;
 }