Example #1
0
 protected Nalu(RBSP rbsp, NaluType nalUnitType, NalRefIdc nalRefIdc)
 {
     startcodeprefixLen = useAnnexbLongStartcode ? 4 : 3;
     this.nalUnitType = nalUnitType;
     this.nalRefIdc = nalRefIdc;
     forbiddenZeroBit = 0;
     this.rbsp = rbsp;
     useAnnexbLongStartcode = true;
 }
Example #2
0
        public static byte GetNaluTypeByte(NaluType Type)
        {
            var NaluTypeByte = 0;
            var nal_ref_idc  = 3;

            NaluTypeByte |= nal_ref_idc << 5;
            NaluTypeByte |= (int)Type;
            return((byte)NaluTypeByte);
        }
Example #3
0
        public static byte[] RawToAnnexb4(byte[] Packet, NaluType Type)
        {
            var AnnexPacket = new byte[Packet.Length + 5];

            Array.Copy(Packet, 0, AnnexPacket, 5, Packet.Length);
            AnnexPacket[0] = 0;
            AnnexPacket[1] = 0;
            AnnexPacket[2] = 0;
            AnnexPacket[3] = 1;
            AnnexPacket[4] = GetNaluTypeByte(Type);
            return(AnnexPacket);
        }
        public SliceHeader(Slice slice, Nalu nalu, SequenceParameterSet sps, PictureParameterSet pps)
        {
            this.slice = slice;

            // BEGIN: parameters from Nalu, Picture Par Set and Sequence Par Set
            picParameterSetId = pps.PicParameterSetId;
            log2MaxFrameNumMinus4 = sps.Log2MaxFrameNumMinus4;
            frameMbsOnlyFlag = sps.FrameMbsOnlyFlag;
            picOrderCntType = sps.PicOrderCntType;
            log2MaxPicOrderCntLsbMinus4 = sps.Log2MaxPicOrderCntLsbMinus4;
            picInitQpMinus26 = pps.PicInitQpMinus26;
            nalRefIdc = nalu.NalRefIdc;
            nalUnitType = nalu.NalUnitType;
            // END: parameters from Nalu, Picture Par Set and Sequence Par Set

            sliceType = slice.Picture.TypeOfSlice;
            firstMbInSlice = slice.Picture.CurrentMbNr;
            noOutputOfPriorPicsFlag = false;
            longTermReferenceFlag = false;
            sliceQpDelta = (slice.Qp - 26 - picInitQpMinus26);
        }
 public NaluByteStream(RBSP rbsp,NaluType nalUnitType,NalRefIdc nalReferenceIdc)
     : base(rbsp, nalUnitType, nalReferenceIdc)
 {
 }