public static QuantMatrixExtension read(BitReader inn)
        {
            QuantMatrixExtension qme = new QuantMatrixExtension();

            if (inn.read1Bit() != 0)
            {
                qme.intra_quantiser_matrix = readQMat(inn);
            }
            if (inn.read1Bit() != 0)
            {
                qme.non_intra_quantiser_matrix = readQMat(inn);
            }
            if (inn.read1Bit() != 0)
            {
                qme.chroma_intra_quantiser_matrix = readQMat(inn);
            }
            if (inn.read1Bit() != 0)
            {
                qme.chroma_non_intra_quantiser_matrix = readQMat(inn);
            }

            return(qme);
        }
Beispiel #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);
            }
        }