public override void Read(BitReader bitReader)
        {
            base.Read(bitReader);

            Profile                = bitReader.ReadByte();
            Constraints            = bitReader.ReadByte();
            Level                  = bitReader.ReadByte();
            gSPSID                 = bitReader.DecodeUnsignedExpGolomb();
            gLog2MaxFrameNumMinus4 = bitReader.DecodeUnsignedExpGolomb();
            gPicOrderCntType       = bitReader.DecodeUnsignedExpGolomb();
            if (gPicOrderCntType == 0)
            {
                gMaxPicOrderCntLsbMinus4 = bitReader.DecodeUnsignedExpGolomb();
            }
            else if (gPicOrderCntType == 1)
            {
                DeltaPicOrderAlwaysZero         = bitReader.GetNextBit();
                gOffsetForNonRefPic             = bitReader.DecodeSignedExpGolomb();
                gOffsetForTopToBottomField      = bitReader.DecodeSignedExpGolomb();
                gNumRefFramesInPicOrderCntCycle = bitReader.DecodeUnsignedExpGolomb();
                gOffsetsForRefFrames            = new int[gNumRefFramesInPicOrderCntCycle];
                for (int i = 0; i < gNumRefFramesInPicOrderCntCycle; i++)
                {
                    gOffsetsForRefFrames[i] = bitReader.DecodeSignedExpGolomb();
                }
            }
            gNumRefFrames = bitReader.DecodeUnsignedExpGolomb();
            GapsInFrameNumValueAllowed = bitReader.GetNextBit();
            gPicWidthInMBsMinus1       = bitReader.DecodeUnsignedExpGolomb();
            Width = gPicWidthInMBsMinus1 + 1;
            gPicHeightInMBsMinus1 = bitReader.DecodeUnsignedExpGolomb();
            Height       = gPicHeightInMBsMinus1 + 1;
            PicSizeInMBs = Height * Width;
            FrameMBSOnly = bitReader.GetNextBit();
            uint interlaceFactor = (FrameMBSOnly) ? 1U : 2U;

            Width  *= 16;
            Height *= (16 * interlaceFactor);
            if (!FrameMBSOnly)
            {
                MBAdaptiveFrameField = bitReader.GetNextBit();
            }
            Direct8x8Inference = bitReader.GetNextBit();
            FrameCropping      = bitReader.GetNextBit();
            if (FrameCropping)
            {
                FrameCropLeftOffset   = bitReader.DecodeUnsignedExpGolomb();
                FrameCropRightOffset  = bitReader.DecodeUnsignedExpGolomb();
                FrameCropTopOffset    = bitReader.DecodeUnsignedExpGolomb();
                FrameCropBottomOffset = bitReader.DecodeUnsignedExpGolomb();
            }
            VUIParametersPresent = bitReader.GetNextBit();
            if (VUIParametersPresent)
            {
                vuiParams = new VUIParams();
                vuiParams.Read(bitReader);
            }
        }
Esempio n. 2
0
        public override void Read(BitReader bitReader)
        {
            base.Read(bitReader);

              Profile = bitReader.ReadByte();
              Constraints = bitReader.ReadByte();
              Level = bitReader.ReadByte();
              gSPSID = bitReader.DecodeUnsignedExpGolomb();
              gLog2MaxFrameNumMinus4 = bitReader.DecodeUnsignedExpGolomb();
              gPicOrderCntType = bitReader.DecodeUnsignedExpGolomb();
              if (gPicOrderCntType == 0)
            gMaxPicOrderCntLsbMinus4 = bitReader.DecodeUnsignedExpGolomb();
              else if (gPicOrderCntType == 1)
              {
            DeltaPicOrderAlwaysZero = bitReader.GetNextBit();
            gOffsetForNonRefPic = bitReader.DecodeSignedExpGolomb();
            gOffsetForTopToBottomField = bitReader.DecodeSignedExpGolomb();
            gNumRefFramesInPicOrderCntCycle = bitReader.DecodeUnsignedExpGolomb();
            gOffsetsForRefFrames = new int[gNumRefFramesInPicOrderCntCycle];
            for (int i = 0; i < gNumRefFramesInPicOrderCntCycle; i++)
              gOffsetsForRefFrames[i] = bitReader.DecodeSignedExpGolomb();
              }
              gNumRefFrames = bitReader.DecodeUnsignedExpGolomb();
              GapsInFrameNumValueAllowed = bitReader.GetNextBit();
              gPicWidthInMBsMinus1 = bitReader.DecodeUnsignedExpGolomb();
              Width = gPicWidthInMBsMinus1 + 1;
              gPicHeightInMBsMinus1 = bitReader.DecodeUnsignedExpGolomb();
              Height = gPicHeightInMBsMinus1 + 1;
              PicSizeInMBs = Height * Width;
              FrameMBSOnly = bitReader.GetNextBit();
              uint interlaceFactor = (FrameMBSOnly) ? 1U : 2U;
              Width *= 16;
              Height *= (16 * interlaceFactor);
              if (!FrameMBSOnly)
            MBAdaptiveFrameField = bitReader.GetNextBit();
              Direct8x8Inference = bitReader.GetNextBit();
              FrameCropping = bitReader.GetNextBit();
              if (FrameCropping)
              {
            FrameCropLeftOffset = bitReader.DecodeUnsignedExpGolomb();
            FrameCropRightOffset = bitReader.DecodeUnsignedExpGolomb();
            FrameCropTopOffset = bitReader.DecodeUnsignedExpGolomb();
            FrameCropBottomOffset = bitReader.DecodeUnsignedExpGolomb();
              }
              VUIParametersPresent = bitReader.GetNextBit();
              if (VUIParametersPresent)
              {
            vuiParams = new VUIParams();
            vuiParams.Read(bitReader);
              }
        }