public static PictureDisplayExtension read(BitReader bits, SequenceExtension se, PictureCodingExtension pce)
        {
            PictureDisplayExtension pde = new PictureDisplayExtension();

            pde.frame_centre_offsets = new Point[numberOfFrameCentreOffsets(se, pce)];
            for (int i = 0; i < pde.frame_centre_offsets.Length; i++)
            {
                int frame_centre_horizontal_offset = bits.readNBit(16);
                bits.read1Bit();
                int frame_centre_vertical_offset = bits.readNBit(16);
                bits.read1Bit();
                pde.frame_centre_offsets[i] = new Point(frame_centre_horizontal_offset, frame_centre_vertical_offset);
            }
            return(pde);
        }
Esempio n. 2
0
        public static void readExtension(MemoryStream bb, PictureHeader ph, SequenceHeader sh)
        {
            ph.m_hasExtensions = true;
            BitReader inb     = new BitReader(bb);
            int       extType = inb.readNBit(4);

            switch (extType)
            {
            case Quant_Matrix_Extension:
                ph.quantMatrixExtension = QuantMatrixExtension.read(inb);
                break;

            case Copyright_Extension:
                ph.copyrightExtension = CopyrightExtension.read(inb);
                break;

            case Picture_Display_Extension:
                ph.pictureDisplayExtension = PictureDisplayExtension.read(inb, sh.sequenceExtension,
                                                                          ph.pictureCodingExtension);
                break;

            case Picture_Coding_Extension:
                ph.pictureCodingExtension = PictureCodingExtension.read(inb);
                break;

            case Picture_Spatial_Scalable_Extension:
                ph.pictureSpatialScalableExtension = PictureSpatialScalableExtension.read(inb);
                break;

            case Picture_Temporal_Scalable_Extension:
                ph.pictureTemporalScalableExtension = PictureTemporalScalableExtension.read(inb);
                break;

            default:
                throw new Exception("Unsupported extension: " + extType);
            }
        }