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); } }
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); } }
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(); } }
private void SEIMessage(BitReader bitReader) { byte lastTypeByte; PayloadType = 0; while (0xFF == (lastTypeByte = bitReader.ReadByte())) { PayloadType += 255; } PayloadType += lastTypeByte; byte lastSizeByte; PayloadSize = 0; while (0xFF == (lastSizeByte = bitReader.ReadByte())) { PayloadSize += 255; } PayloadSize += lastSizeByte; SEIPayload(); }
// start reading at a byte boundary public virtual void Read(BitReader bitReader) { _positionInStream = bitReader.Position; Byte firstByte = bitReader.ReadByte(); Byte idc = (Byte)(firstByte >> 5); if ((idc > 0) != (NALRefIDC > 0)) // if it's not as expected, then throw exception { throw new Exception("NALU base class: unexpected Ref IDC"); } NALUnitType naluType = (NALUnitType)(firstByte & 0x1F); if (naluType != NALUType) { throw new Exception("NALU base class: unexpected NALU type"); } }
// start reading at a byte boundary public virtual void Read(BitReader bitReader) { _positionInStream = bitReader.Position; Byte firstByte = bitReader.ReadByte(); Byte idc = (Byte)(firstByte >> 5); if ((idc > 0) != (NALRefIDC > 0)) // if it's not as expected, then throw exception throw new Exception("NALU base class: unexpected Ref IDC"); NALUnitType naluType = (NALUnitType)(firstByte & 0x1F); if (naluType != NALUType) throw new Exception("NALU base class: unexpected NALU type"); }
private void SEIMessage(BitReader bitReader) { byte lastTypeByte; PayloadType = 0; while (0xFF == (lastTypeByte = bitReader.ReadByte())) PayloadType += 255; PayloadType += lastTypeByte; byte lastSizeByte; PayloadSize = 0; while (0xFF == (lastSizeByte = bitReader.ReadByte())) PayloadSize += 255; PayloadSize += lastSizeByte; SEIPayload(); }