public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; reader.State.Picture.Reset(); reader.State.SeenGop = false; if ((reader.State.LastHeaderName != null) && (reader.State.LastHeaderName != Slice.Name)) { resultState.Invalidate(); return; // Invalid header sequence } ISequenceState sequenceState = reader.State.Sequence; sequenceState.Reset(); sequenceState.Initialized = true; sequenceState.HorizontalSize = (ushort)reader.GetBits(12, Attribute.HorizontalSizeValue); sequenceState.VerticalSize = (ushort)reader.GetBits(12, Attribute.VerticalSizeValue); reader.GetBits(4, Attribute.AspectRatioInformation, AspectRatioResultFormatter); reader.GetBits(4, Attribute.FrameRateCode, FrameRateResultFormatter); reader.GetBits(18, Attribute.BitRateValue); reader.GetMarker(); reader.GetBits(10, Attribute.VbvBufferSizeValue); reader.GetFlag(Attribute.ConstrainedParametersFlag); if (reader.GetFlag(Attribute.LoadIntraQuantiserMatrix)) { reader.GetData(Attribute.IntraQuantiserMatrix, 64); } if (reader.GetFlag(Attribute.LoadNonIntraQuantiserMatrix)) { reader.GetData(Attribute.NonIntraQuantiserMatrix, 64); } }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; ScalableMode scalableMode = (ScalableMode)reader.GetBits(2, Attribute.ScalableMode, _scalableModeResultFormatter); reader.State.Sequence.ScalableMode = scalableMode; reader.GetBits(4, Attribute.LayerID); if (scalableMode == ScalableMode.SpatialScalability) { reader.GetBits(14, Attribute.LowerLayerPredictionHorizontalSize); reader.GetMarker(); reader.GetBits(14, Attribute.LowerLayerPredictionVerticalSize); reader.GetBits(5, Attribute.HorizontalSubsamplingFactorM); reader.GetBits(5, Attribute.HorizontalSubsamplingFactorN); reader.GetBits(5, Attribute.VerticalSubsamplingFactorM); reader.GetBits(5, Attribute.VerticalSubsamplingFactorN); } if (scalableMode == ScalableMode.TemporalScalability) { if (reader.GetFlag(Attribute.PictureMuxEnable)) { reader.GetFlag(Attribute.MuxToProgressiveSequence); } reader.GetBits(3, Attribute.PictureMuxOrder); reader.GetBits(3, Attribute.PictureMuxFactor); } }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { IPictureState pictureState = reader.State.Picture; resultState.Name = Name; // It can occur after the last slice of the previous picture or after a sequence header // or group of pictures header, possible followed by user data and/or extensions. if ((reader.State.LastHeaderName != Slice.Name) && pictureState.Initialized) { resultState.Invalidate(); return; } if (!reader.State.Sequence.Initialized && !reader.State.SeenGop) { reader.InsertReferenceHeaderBeforeStartCode(); } pictureState.Reset(); reader.State.Slice.Reset(); reader.GetBits(10, Attribute.TemporalReference); var pictureCodingType = (PictureCodingType)reader.GetBits(3, Attribute.PictureCodingType, _pictureCodingTypeResultFormatter); pictureState.CodingType = pictureCodingType; reader.GetBits(16, Attribute.VbvDelay); if ((pictureCodingType == PictureCodingType.PType) || (pictureCodingType == PictureCodingType.BType)) { reader.GetFlag(Attribute.FullPelForwardVector); byte forwardFCode = (byte)reader.GetBits(3, Attribute.ForwardFCode); pictureState.ForwardHorizontalFCode = forwardFCode; pictureState.ForwardVerticalFCode = forwardFCode; } if (pictureCodingType == PictureCodingType.BType) { reader.GetFlag(Attribute.FullPelBackwardVector); byte backwardFCode = (byte)reader.GetBits(3, Attribute.BackwardFCode); pictureState.BackwardHorizontalFCode = backwardFCode; pictureState.BackwardVerticalFCode = backwardFCode; } int count = 0; // Sanity check uint maxExtraInformationLength = reader.State.Configuration.PictureHeaderMaxLengthOfExtraInformation; while (reader.ShowBits(1) == 1) { reader.GetBits(1); // ExtraBitPicture reader.GetBits(8); // ExtraInformationPicture if (count++ > maxExtraInformationLength) { resultState.Invalidate(); return; } } }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; reader.GetFlag(Attribute.CopyrightFlag); reader.GetBits(8, Attribute.CopyrightIdentifier); reader.GetFlag(Attribute.OriginalOrCopy); // TODO: true = original, false = copy reader.GetReservedBits(7); reader.GetMarker(); reader.GetAttribute(_copyrightNumberAttribute); }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; reader.GetBits(10, Attribute.LowerLayerTemporalReference); reader.GetMarker(); reader.GetBits(15, Attribute.LowerLayerHorizontalOffset); reader.GetMarker(); reader.GetBits(15, Attribute.LowerLayerVerticalOffset); reader.State.Picture.SpatialScalability = true; reader.State.Picture.SpatialTemporalWeightCodeTableIndex = (byte)reader.GetBits(2, Attribute.SpatialTemporalWeightCodeTableIndex); reader.GetFlag(Attribute.LowerLayerProgressiveFrame); reader.GetFlag(Attribute.LowerLayerDeinterlacedFieldSelect); }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; if ((reader.State.LastHeaderName != SequenceHeader.Name)) { resultState.Invalidate(); return; // Invalid header sequence } ISequenceState sequenceState = reader.State.Sequence; reader.GetBits(8, Attribute.ProfileAndLevelIndication); sequenceState.Progressive = reader.GetFlag(Attribute.ProgressiveSequence); sequenceState.ChromaFormat = (ChromaFormat)reader.GetBits(2, Attribute.ChromaFormat); uint horizontalSizeExtension = reader.GetBits(2, Attribute.HorizontalSizeExtension); sequenceState.HorizontalSize = (ushort)((sequenceState.HorizontalSize & 0x0fff) | (horizontalSizeExtension << 12)); uint verticalSizeExtension = reader.GetBits(2, Attribute.VerticalSizeExtension); sequenceState.VerticalSize = (ushort)((sequenceState.VerticalSize & 0x0fff) | (verticalSizeExtension << 12)); reader.GetBits(12, Attribute.BitRateExtension); reader.GetMarker(); reader.GetBits(8, Attribute.VbvBufferSizeExtension); reader.GetBits(1, Attribute.LowDelay); reader.GetBits(2, Attribute.FrameRateExtensionN); reader.GetBits(5, Attribute.FrameRateExtensionD); }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; if (reader.GetFlag(Attribute.LoadIntraQuantiserMatrix)) { reader.GetData(Attribute.IntraQuantiserMatrix, 64); } if (reader.GetFlag(Attribute.LoadNonIntraQuantiserMatrix)) { reader.GetData(Attribute.NonIntraQuantiserMatrix, 64); } if (reader.GetFlag(Attribute.LoadChromaIntraQuantiserMatrix)) { reader.GetData(Attribute.ChromaIntraQuantiserMatrix, 64); } if (reader.GetFlag(Attribute.LoadChromaNonIntraQuantiserMatrix)) { reader.GetData(Attribute.ChromaNonIntraQuantiserMatrix, 64); } }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; IMpeg2VideoState state = reader.State; // It can occur after the last slice of a picture or after a sequence header, possible followed by user data and/or extensions if ((state.LastHeaderName != Slice.Name) && (state.LastHeaderName != null) && (!state.Sequence.Initialized || state.SeenGop || state.Picture.Initialized)) { resultState.Invalidate(); return; } if (!reader.State.Sequence.Initialized) { reader.InsertReferenceHeaderBeforeStartCode(); } state.SeenGop = true; state.Picture.Reset(); reader.GetAttribute(_timeCodeAttribute); reader.GetFlag(Attribute.ClosedGop); reader.GetFlag(Attribute.BrokenLink); }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; reader.GetBits(3, Attribute.VideoFormat, _videoFormatResultFormatter); if (reader.GetFlag(Attribute.ColourDescription)) { reader.GetBits(8, Attribute.ColourPrimaries); reader.GetBits(8, Attribute.TransferCharacteristics); reader.GetBits(8, Attribute.MatrixCoefficients); } reader.GetBits(14, Attribute.DisplayHorizontalSize); reader.GetMarker(); reader.GetBits(14, Attribute.DisplayVerticalSize); }
public void Parse(IMpeg2VideoReader reader, IResultNodeState resultState) { resultState.Name = Name; if (reader.State.LastHeaderName != PictureHeader.Name) { resultState.Invalidate(); return; // Invalid header sequence } IPictureState pictureState = reader.State.Picture; pictureState.ForwardHorizontalFCode = (byte)reader.GetBits(4, Attribute.ForwardHorizontalFCode); pictureState.ForwardVerticalFCode = (byte)reader.GetBits(4, Attribute.ForwardVerticalFCode); pictureState.BackwardHorizontalFCode = (byte)reader.GetBits(4, Attribute.BackwardHorizontalFCode); pictureState.BackwardVerticalFCode = (byte)reader.GetBits(4, Attribute.BackwardVerticalFCode); reader.GetBits(2, Attribute.IntraDCPrecision); pictureState.Structure = (PictureStructure)reader.GetBits(2, Attribute.PictureStructure, _pictureStructureResultFormatter); pictureState.TopFieldFirst = reader.GetFlag(Attribute.TopFieldFirst); pictureState.FramePredFrameDct = reader.GetFlag(Attribute.FramePredFrameDct); pictureState.ConcealmentMotionVectors = reader.GetFlag(Attribute.ConcealmentMotionVectors); reader.GetBits(1, Attribute.QuantiserScaleType); pictureState.IntraVlcFormat = (reader.GetBits(1, Attribute.IntraVlcFormat) == 0) ? false : true; reader.GetFlag(Attribute.AlternateScan); pictureState.RepeatFirstField = reader.GetFlag(Attribute.RepeatFirstField); reader.GetFlag(Attribute.Chroma420Type); reader.GetFlag(Attribute.ProgressiveFrame); if (reader.GetFlag(Attribute.CompositeDisplayFlag)) { reader.GetBits(1, Attribute.VAxis); reader.GetBits(3, Attribute.FieldSequence); reader.GetBits(1, Attribute.SubCarrier); reader.GetBits(7, Attribute.BurstAmplitude); reader.GetBits(8, Attribute.SubCarrierPhase); } }