Esempio n. 1
0
        public void ReadPps(H264Bitstream r)
        {
            this._slicePicParameterSetId = new uint?();
            r.ReadBits(1);
            r.ReadBits(2);
            r.ReadBits(5);
            this._picParameterSetId    = new uint?(H264BitstreamExtensions.ReadUe(r));
            this._ppsSeqParameterSetId = new uint?(H264BitstreamExtensions.ReadUe(r));
            r.ReadBits(1);
            this._bottomFieldPicOrderInFramePresentFlag = new uint?(r.ReadBits(1));
            uint num1 = H264BitstreamExtensions.ReadUe(r);

            if (num1 > 0U)
            {
                uint num2 = H264BitstreamExtensions.ReadUe(r);
                if (0 == (int)num2)
                {
                    for (int index = 0; (long)index <= (long)num1; ++index)
                    {
                        H264BitstreamExtensions.ReadUe(r);
                    }
                }
                else if (2 == (int)num2)
                {
                    for (int index = 0; (long)index < (long)num1; ++index)
                    {
                        H264BitstreamExtensions.ReadUe(r);
                        H264BitstreamExtensions.ReadUe(r);
                    }
                }
                else if (3 == (int)num2 || 4 == (int)num2 || 5 == (int)num2)
                {
                    r.ReadBits(1);
                    H264BitstreamExtensions.ReadUe(r);
                }
                else if (6 == (int)num2)
                {
                    int  bitSize = H264Reader.GetBitSize(num1);
                    uint num3    = H264BitstreamExtensions.ReadUe(r);
                    for (int index = 0; (long)index <= (long)num3; ++index)
                    {
                        r.ReadBits(bitSize);
                    }
                }
            }
            H264BitstreamExtensions.ReadUe(r);
            H264BitstreamExtensions.ReadUe(r);
            r.ReadBits(1);
            r.ReadBits(2);
            H264BitstreamExtensions.ReadSe(r);
            H264BitstreamExtensions.ReadSe(r);
            H264BitstreamExtensions.ReadSe(r);
            r.ReadBits(1);
            r.ReadBits(1);
            this._redundantPicCntPresentFlag = new uint?(r.ReadBits(1));
            if (!this.more_rbsp_data(r))
            {
                return;
            }
            uint num4 = r.ReadBits(1);

            if (0 != (int)r.ReadBits(1))
            {
                int num2 = 0;
                while (true)
                {
                    long num3     = (long)num2;
                    long num5     = 6;
                    uint?nullable = this._chromaFormatIdc;
                    long num6     = (((int)nullable.GetValueOrDefault() != 3 ? 1 : (!nullable.HasValue ? 1 : 0)) != 0 ? 2L : 6L) * (long)num4;
                    long num7     = num5 + num6;
                    if (num3 < num7)
                    {
                        if (0 != (int)r.ReadBits(1))
                        {
                            if (num2 < 6)
                            {
                                this.ReadScalingList(r, 16);
                            }
                            else
                            {
                                this.ReadScalingList(r, 64);
                            }
                        }
                        ++num2;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            H264BitstreamExtensions.ReadSe(r);
        }
Esempio n. 2
0
        public void ReadSps(H264Bitstream r)
        {
            this._ppsSeqParameterSetId = new uint?();
            r.ReadBits(1);
            r.ReadBits(2);
            r.ReadBits(5);
            uint profile_idc     = r.ReadBits(8);
            uint constraint_sets = r.ReadBits(8);
            uint num1            = r.ReadBits(8);

            this._seqParameterSetId = new uint?(H264BitstreamExtensions.ReadUe(r));
            if (Array.BinarySearch <uint>(H264Reader.ProfileIdcHasChromaFormat, profile_idc) >= 0)
            {
                uint num2 = H264BitstreamExtensions.ReadUe(r);
                this._chromaFormatIdc = new uint?(num2);
                if (3 == (int)num2)
                {
                    this._separateColourPlaneFlag = new uint?(r.ReadBits(1));
                }
                H264BitstreamExtensions.ReadUe(r);
                H264BitstreamExtensions.ReadUe(r);
                r.ReadBits(1);
                if (0 != (int)r.ReadBits(1))
                {
                    for (int index = 0; index < (3 != (int)num2 ? 8 : 12); ++index)
                    {
                        if (0 != (int)r.ReadBits(1))
                        {
                            this.ParseScalingList(r, index < 6 ? 16 : 64);
                        }
                    }
                }
            }
            this._log2MaxFrameNumMinus4 = new uint?(H264BitstreamExtensions.ReadUe(r));
            uint num3 = H264BitstreamExtensions.ReadUe(r);

            this._picOrderCntType = new uint?(num3);
            if (0 == (int)num3)
            {
                H264BitstreamExtensions.ReadUe(r);
            }
            else if (1 == (int)num3)
            {
                this._deltaPicOrderAlwaysZeroFlag = new uint?(r.ReadBits(1));
                H264BitstreamExtensions.ReadSe(r);
                H264BitstreamExtensions.ReadSe(r);
                uint num2 = H264BitstreamExtensions.ReadUe(r);
                for (int index = 0; (long)index < (long)num2; ++index)
                {
                    H264BitstreamExtensions.ReadSe(r);
                }
            }
            H264BitstreamExtensions.ReadUe(r);
            r.ReadBits(1);
            uint num4 = H264BitstreamExtensions.ReadUe(r);
            uint num5 = H264BitstreamExtensions.ReadUe(r);
            uint num6 = r.ReadBits(1);

            this._frameMbsOnlyFlag = new uint?(num6);
            if (0 == (int)num6)
            {
                r.ReadBits(1);
            }
            r.ReadBits(1);
            uint num7 = r.ReadBits(1);
            uint num8 = (uint)(((int)num4 + 1) * 16);
            uint num9 = (uint)((2 - (int)num6) * ((int)num5 + 1) * 16);

            if (0 != (int)num7)
            {
                uint num2  = H264BitstreamExtensions.ReadUe(r);
                uint num10 = H264BitstreamExtensions.ReadUe(r);
                uint num11 = H264BitstreamExtensions.ReadUe(r);
                uint num12 = H264BitstreamExtensions.ReadUe(r);
                num8 = (uint)((int)num8 - (int)num2 * 2 - (int)num10 * 2);
                num9 = (uint)((int)num9 - (int)num11 * 2 - (int)num12 * 2);
            }
            if (0 != (int)r.ReadBits(1))
            {
                this.ReadVuiParameters(r);
            }
            this.Height = new int?((int)num9);
            this.Width  = new int?((int)num8);
            this.Name   = string.Format("H.264 \"{0}\" profile, level {1} {2}x{3}", (object)H264Reader.ProfileName(profile_idc, constraint_sets), (object)((double)num1 / 10.0), (object)num8, (object)num9);
        }