public void Read(BitReader bitReader) { if ((_mbLayer.MbPartPredMode(_mbType, 0) == MacroBlockPartitionMode.Intra_4x4) || (_mbLayer.MbPartPredMode(_mbType, 0) == MacroBlockPartitionMode.Intra_16x16)) { if (_mbLayer.MbPartPredMode(_mbType, 0) == MacroBlockPartitionMode.Intra_4x4) { for (int luma4x4ids = 0; luma4x4ids < 16; luma4x4ids++) { PrevIntra4x4PredModeFlag[luma4x4ids] = bitReader.GetNextBit(); if (!PrevIntra4x4PredModeFlag[luma4x4ids]) { RemIntra4x4PredMode[luma4x4ids] = bitReader.GetByteFromNBits(3); } } } IntraChromaPredMode = (byte)bitReader.DecodeUnsignedExpGolomb(); } else if (_mbLayer.MbPartPredMode(_mbType, 0) != MacroBlockPartitionMode.Direct) { int numPart = (int)_mbLayer.NumMbPart(_mbType); for (int mbPartIdx = 0; mbPartIdx < numPart; mbPartIdx++) { } for (int mbPartIdx = 0; mbPartIdx < numPart; mbPartIdx++) { } for (int mbPartIdx = 0; mbPartIdx < numPart; mbPartIdx++) { } for (int mbPartIdx = 0; mbPartIdx < numPart; mbPartIdx++) { } } }
public override void Read(BitReader bitReader) { base.Read(bitReader); PrimaryPicType = (PictureType)bitReader.GetByteFromNBits(3); bitReader.DiscardTrailingBits(); // complete the byte while (MoreRBSPData(bitReader)) bitReader.ReadByte(); }
public override void Read(BitReader bitReader) { base.Read(bitReader); PrimaryPicType = (PictureType)bitReader.GetByteFromNBits(3); bitReader.DiscardTrailingBits(); // complete the byte while (MoreRBSPData(bitReader)) { bitReader.ReadByte(); } }
public byte TimeOffsetLength; // 0 u(5) //} public void Read(BitReader bitReader) { CpbCount = bitReader.DecodeUnsignedExpGolomb() + 1; BitRateScale = bitReader.GetByteFromNBits(4); CpbSizeScale = bitReader.GetByteFromNBits(4); BitRateValue = new uint[CpbCount]; CpbSizeValue = new uint[CpbCount]; Cbr = new bool[CpbCount]; for (int i = 0; i < CpbCount; i++) { BitRateValue[i] = bitReader.DecodeUnsignedExpGolomb() + 1; CpbSizeValue[i] = bitReader.DecodeUnsignedExpGolomb() + 1; Cbr[i] = bitReader.GetNextBit(); } InitialCpbRemovalDelayLength = (byte)(bitReader.GetByteFromNBits(5) + 1); CpbRemovalDelayLength = (byte)(bitReader.GetByteFromNBits(5) + 1); DpbOutputDelayLength = (byte)(bitReader.GetByteFromNBits(5) + 1); TimeOffsetLength = bitReader.GetByteFromNBits(5); }
public void Read(BitReader bitReader) { AspectRatioInfoPresent = bitReader.GetNextBit(); if (AspectRatioInfoPresent) { AspectRatio = bitReader.GetByteFromNBits(8); if (AspectRatio == Extended_SAR) { SARWidth = (ushort)bitReader.GetUIntFromNBits(16); SARHeight = (ushort)bitReader.GetUIntFromNBits(16); } } OverscanInfoPresent = bitReader.GetNextBit(); if (OverscanInfoPresent) { OverscanAppropriate = bitReader.GetNextBit(); } VideoSignalTypePresent = bitReader.GetNextBit(); if (VideoSignalTypePresent) { VideoFormat = bitReader.GetByteFromNBits(3); VideoFullRange = bitReader.GetNextBit(); ColourDescriptionPresent = bitReader.GetNextBit(); if (ColourDescriptionPresent) { ColourPrimaries = bitReader.GetByteFromNBits(8); TransferCharacteristics = bitReader.GetByteFromNBits(8); MatrixCoefficients = bitReader.GetByteFromNBits(8); } } ChromaLocInfoPresent = bitReader.GetNextBit(); if (ChromaLocInfoPresent) { ChromaSampleLocTypeTopField = bitReader.DecodeUnsignedExpGolomb(); ChromaSampleLocTypeBottomField = bitReader.DecodeUnsignedExpGolomb(); } TimingInfoPresent = bitReader.GetNextBit(); if (TimingInfoPresent) { NumUnitsInTick = bitReader.GetUIntFromNBits(32); TimeScale = bitReader.GetUIntFromNBits(32); FixedFrameRate = bitReader.GetNextBit(); } NALHRDParametersPresent = bitReader.GetNextBit(); if (NALHRDParametersPresent) { NalHRDParams = new HRDParams(); NalHRDParams.Read(bitReader); } VclHRDParametersPresent = bitReader.GetNextBit(); if (VclHRDParametersPresent) { VclHRDParams = new HRDParams(); VclHRDParams.Read(bitReader); } if (NALHRDParametersPresent || VclHRDParametersPresent) { LowDelayHRDFlag = bitReader.GetNextBit(); } PicStructPresent = bitReader.GetNextBit(); BitstreamRestriction = bitReader.GetNextBit(); if (BitstreamRestriction) { MotionVectorsOverPicBoundaries = bitReader.GetNextBit(); MaxBytesPerPicDenom = bitReader.DecodeUnsignedExpGolomb(); MaxBitsPerMBDenom = bitReader.DecodeUnsignedExpGolomb(); Log2MaxMVLengthHorizontal = bitReader.DecodeUnsignedExpGolomb(); Log2MaxMVLengthVertical = bitReader.DecodeUnsignedExpGolomb(); NumReorderFrames = bitReader.DecodeUnsignedExpGolomb(); MaxDecFrameBuffering = bitReader.DecodeUnsignedExpGolomb(); } if ((AspectRatio > 0) && (AspectRatio < 17)) { AspectRatioX = vui_aspect_x[AspectRatio]; AspectRatioY = vui_aspect_y[AspectRatio]; } // gWidth = (uint)(gWidth * ((double)vui_aspect_x[vuiParams.AspectRatio]) / ((double)vui_aspect_y[vuiParams.AspectRatio])); }
public void Read(BitReader bitReader) { AspectRatioInfoPresent = bitReader.GetNextBit(); if (AspectRatioInfoPresent) { AspectRatio = bitReader.GetByteFromNBits(8); if (AspectRatio == Extended_SAR) { SARWidth = (ushort)bitReader.GetUIntFromNBits(16); SARHeight = (ushort)bitReader.GetUIntFromNBits(16); } } OverscanInfoPresent = bitReader.GetNextBit(); if (OverscanInfoPresent) OverscanAppropriate = bitReader.GetNextBit(); VideoSignalTypePresent = bitReader.GetNextBit(); if (VideoSignalTypePresent) { VideoFormat = bitReader.GetByteFromNBits(3); VideoFullRange = bitReader.GetNextBit(); ColourDescriptionPresent = bitReader.GetNextBit(); if (ColourDescriptionPresent) { ColourPrimaries = bitReader.GetByteFromNBits(8); TransferCharacteristics = bitReader.GetByteFromNBits(8); MatrixCoefficients = bitReader.GetByteFromNBits(8); } } ChromaLocInfoPresent = bitReader.GetNextBit(); if (ChromaLocInfoPresent) { ChromaSampleLocTypeTopField = bitReader.DecodeUnsignedExpGolomb(); ChromaSampleLocTypeBottomField = bitReader.DecodeUnsignedExpGolomb(); } TimingInfoPresent = bitReader.GetNextBit(); if (TimingInfoPresent) { NumUnitsInTick = bitReader.GetUIntFromNBits(32); TimeScale = bitReader.GetUIntFromNBits(32); FixedFrameRate = bitReader.GetNextBit(); } NALHRDParametersPresent = bitReader.GetNextBit(); if (NALHRDParametersPresent) { NalHRDParams = new HRDParams(); NalHRDParams.Read(bitReader); } VclHRDParametersPresent = bitReader.GetNextBit(); if (VclHRDParametersPresent) { VclHRDParams = new HRDParams(); VclHRDParams.Read(bitReader); } if (NALHRDParametersPresent || VclHRDParametersPresent) LowDelayHRDFlag = bitReader.GetNextBit(); PicStructPresent = bitReader.GetNextBit(); BitstreamRestriction = bitReader.GetNextBit(); if (BitstreamRestriction) { MotionVectorsOverPicBoundaries = bitReader.GetNextBit(); MaxBytesPerPicDenom = bitReader.DecodeUnsignedExpGolomb(); MaxBitsPerMBDenom = bitReader.DecodeUnsignedExpGolomb(); Log2MaxMVLengthHorizontal = bitReader.DecodeUnsignedExpGolomb(); Log2MaxMVLengthVertical = bitReader.DecodeUnsignedExpGolomb(); NumReorderFrames = bitReader.DecodeUnsignedExpGolomb(); MaxDecFrameBuffering = bitReader.DecodeUnsignedExpGolomb(); } if ((AspectRatio > 0) && (AspectRatio < 17)) { AspectRatioX = vui_aspect_x[AspectRatio]; AspectRatioY = vui_aspect_y[AspectRatio]; } // gWidth = (uint)(gWidth * ((double)vui_aspect_x[vuiParams.AspectRatio]) / ((double)vui_aspect_y[vuiParams.AspectRatio])); }
private void PicTiming() { bool CpbDpbDelaysPresent = true; // based on application need, see p. 260 of ITU-T CpbDpbDelaysPresent = CpbDpbDelaysPresent || _sps.vuiParams.NALHRDParametersPresent || _sps.vuiParams.VclHRDParametersPresent; if (CpbDpbDelaysPresent) { CpbRemovalDelay = _bitReader.GetUIntFromNBits(_sps.vuiParams.VclHRDParams.CpbRemovalDelayLength); DpbOutputDelay = _bitReader.GetUIntFromNBits(_sps.vuiParams.VclHRDParams.DpbOutputDelayLength); if ((_sps.vuiParams.MaxDecFrameBuffering == 0) && (DpbOutputDelay != 0)) { throw new Exception("SEI: DpbOutputDelay must be zero "); } } if (_sps.vuiParams.PicStructPresent) { PicStruct = _bitReader.GetByteFromNBits(4); byte count = NumClockTS[PicStruct]; ClockTimestampFlag = new bool[count]; for (int i = 0; i < count; i++) { ClockTimestampFlag[i] = _bitReader.GetNextBit(); if (ClockTimestampFlag[i]) { CTType = _bitReader.GetByteFromNBits(2); UUITFieldBasedFlag = _bitReader.GetNextBit(); CountingType = _bitReader.GetByteFromNBits(5); FullTimestampFlag = _bitReader.GetNextBit(); DiscontinuityFlag = _bitReader.GetNextBit(); CountDroppedFlag = _bitReader.GetNextBit(); NFrames = (ushort)_bitReader.GetUIntFromNBits(8); if (FullTimestampFlag) { SecondsValue = _bitReader.GetByteFromNBits(6); MinutesValue = _bitReader.GetByteFromNBits(6); HoursValue = _bitReader.GetByteFromNBits(5); } else { SecondsFlag = _bitReader.GetNextBit(); if (SecondsFlag) { SecondsValue = _bitReader.GetByteFromNBits(6); MinutesFlag = _bitReader.GetNextBit(); if (MinutesFlag) { MinutesValue = _bitReader.GetByteFromNBits(6); HoursFlag = _bitReader.GetNextBit(); if (HoursFlag) { HoursValue = _bitReader.GetByteFromNBits(5); } } } } ushort offLen = _sps.vuiParams.VclHRDParams.TimeOffsetLength; if (offLen > 0) { TimeOffset = _bitReader.GetUIntFromNBits(offLen); } } } } }